diff --git a/DiscordDivaBot/.classpath b/DiscordDivaBot/.classpath index c66a50f..d525be2 100644 --- a/DiscordDivaBot/.classpath +++ b/DiscordDivaBot/.classpath @@ -1,7 +1,11 @@ - + + + + + - + diff --git a/DiscordDivaBot/munimuni.jar b/DiscordDivaBot/munimuni.jar new file mode 100644 index 0000000..494db7e Binary files /dev/null and b/DiscordDivaBot/munimuni.jar differ diff --git a/DiscordDivaBot/src/sig/DivaBot.java b/DiscordDivaBot/src/sig/DivaBot.java index db6744c..f088cee 100644 --- a/DiscordDivaBot/src/sig/DivaBot.java +++ b/DiscordDivaBot/src/sig/DivaBot.java @@ -6,18 +6,17 @@ import java.util.List; import javax.security.auth.login.LoginException; -import net.dv8tion.jda.core.JDA; -import net.dv8tion.jda.core.JDABuilder; -import net.dv8tion.jda.core.entities.Message; -import net.dv8tion.jda.core.entities.MessageChannel; -import net.dv8tion.jda.core.entities.TextChannel; -import net.dv8tion.jda.core.entities.User; -import net.dv8tion.jda.core.events.Event; -import net.dv8tion.jda.core.events.message.MessageDeleteEvent; -import net.dv8tion.jda.core.events.message.MessageReceivedEvent; -import net.dv8tion.jda.core.hooks.EventListener; -import net.dv8tion.jda.core.hooks.ListenerAdapter; -import net.dv8tion.jda.core.requests.RestAction; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.JDABuilder; +import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageChannel; +import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.events.message.MessageDeleteEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.api.requests.RestAction; import sig.utils.FileUtils; public class DivaBot extends ListenerAdapter{ @@ -29,19 +28,10 @@ public class DivaBot extends ListenerAdapter{ String[] fileContents = FileUtils.readFromFile("clientToken.txt"); //System.out.println(fileContents[0]); token = fileContents[0]; - bot = new JDABuilder(token) - .addEventListener(new DivaBot()).build(); + JDA bot = JDABuilder.createDefault(token).build(); + bot.addEventListener(new DivaBot()); bot.awaitReady(); - - List channels = bot.getTextChannelsByName("bot-tests",true); - RestAction> messageHistory = channels.get(0).getHistory().retrievePast(5); - messageHistory.queue(history-> - { - for (int i=0;i emotes = bot.getEmotes(); + List muniEmotes = new ArrayList(); + for (Emote e : emotes) { + if (e.getName().toLowerCase().contains("muni")) { + muniEmotes.add(e); + } + } + return muniEmotes.get((int)(Math.random()*muniEmotes.size())); + } + + /*@Override public void onMessageDelete(MessageDeleteEvent ev) { if (ValidMessage(null,ev.getChannel())) { Long messageId = ev.getMessageIdLong(); ev.getChannel().sendMessage("Message was deleted: "+messageHistory.get(messageId).getAuthor().getName()+": "+messageHistory.get(messageId).getContentDisplay()) .queue(); } - } + }*/ - public boolean ValidMessage(User author,MessageChannel channel) { - return (author==null||author.getIdLong()!=744693388632391762l) - &&channel.getName().equalsIgnoreCase("bot-tests"); + public boolean ValidMessage(User author,MessageChannel channel,String message) { + return (author==null||author.getIdLong()!=809417111859888168l) + &&(channel.getName().equalsIgnoreCase("bot-tests")|| + channel.getIdLong()==772923108997857291l/*D4DJcord tiering channel*/|| + channel.getName().equalsIgnoreCase(author.getName())) + &&(message.toLowerCase().contains("muni")|| + message.toLowerCase().contains("むに")); } }