DataLogging 😏
This commit is contained in:
parent
45eb227d22
commit
66cded9d7d
3 changed files with 42 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package discord.data.mining;
|
package discord.data.mining;
|
||||||
|
|
||||||
|
import discord.data.mining.listener.BotMessageListener;
|
||||||
import discord.data.mining.listener.MessageListener;
|
import discord.data.mining.listener.MessageListener;
|
||||||
import discord.data.mining.listener.ReadyListener;
|
import discord.data.mining.listener.ReadyListener;
|
||||||
import net.dv8tion.jda.api.AccountType;
|
import net.dv8tion.jda.api.AccountType;
|
||||||
|
|
@ -17,7 +18,8 @@ public class DataMining {
|
||||||
public static String ConsoleLog = "462556910206320640";
|
public static String ConsoleLog = "462556910206320640";
|
||||||
public static ArrayList<JDA> clients = new ArrayList<>();
|
public static ArrayList<JDA> clients = new ArrayList<>();
|
||||||
public static ArrayList<JDA> bots = new ArrayList<>();
|
public static ArrayList<JDA> bots = new ArrayList<>();
|
||||||
public static ArrayList<JDA> manager = new ArrayList<>();
|
private static ArrayList<JDA> manager = new ArrayList<>();
|
||||||
|
public static int bot = 0;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -28,7 +30,7 @@ public class DataMining {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
||||||
for (String Token : botTokens) {
|
for (String Token : botTokens) {
|
||||||
bots.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).build());
|
bots.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).addEventListeners(new BotMessageListener()).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String Token : clientTokens) {
|
for (String Token : clientTokens) {
|
||||||
|
|
|
||||||
21
src/main/java/discord/data/mining/core/DataLog.java
Normal file
21
src/main/java/discord/data/mining/core/DataLog.java
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
package discord.data.mining.core;
|
||||||
|
|
||||||
|
import discord.data.mining.DataMining;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.JDA;
|
||||||
|
import net.dv8tion.jda.api.events.Event;
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
|
public class DataLog {
|
||||||
|
|
||||||
|
public static void log(Event event) {
|
||||||
|
JDA BOT = DataMining.bots.get(DataMining.bot);
|
||||||
|
|
||||||
|
if (event instanceof MessageReceivedEvent) {
|
||||||
|
MessageReceivedEvent msgevent = (MessageReceivedEvent) event;
|
||||||
|
BOT.getTextChannelById(DataMining.MessageLog).sendMessage(new EmbedBuilder()
|
||||||
|
.setTitle("New Message")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package discord.data.mining.listener;
|
||||||
|
|
||||||
|
import discord.data.mining.core.DataLog;
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BotMessageListener extends ListenerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||||
|
if (!event.getGuild().getId().equals("448554629282922527")) {
|
||||||
|
DataLog.log(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue