master
Joshua Sigona 4 years ago
parent e20abbc5e9
commit dee06b09d1
  1. BIN
      DiscordDivaBot/munimuni.jar
  2. 25
      DiscordDivaBot/src/sig/DivaBot.java

Binary file not shown.

@ -24,6 +24,8 @@ public class DivaBot extends ListenerAdapter{
public static String token; public static String token;
public static JDA bot; public static JDA bot;
public static HashMap<Long,Message> messageHistory = new HashMap<>(); public static HashMap<Long,Message> messageHistory = new HashMap<>();
public int lastMessageCount = 0;
public String lastMessage = "";
public static void main(String[] args) throws LoginException, InterruptedException { public static void main(String[] args) throws LoginException, InterruptedException {
String[] fileContents = FileUtils.readFromFile("clientToken.txt"); String[] fileContents = FileUtils.readFromFile("clientToken.txt");
@ -45,6 +47,19 @@ public class DivaBot extends ListenerAdapter{
//System.out.println(ev.getAuthor().getIdLong()); //System.out.println(ev.getAuthor().getIdLong());
if (ApprovedChannel(ev.getChannel(),ev.getAuthor())&&ev.getMessage().getContentDisplay().toLowerCase().contains("muni")) {
if (lastMessageCount>0&&ev.getMessage().getContentDisplay().toLowerCase().equalsIgnoreCase(lastMessage)) {
lastMessageCount++;
} else {
lastMessageCount=1;
lastMessage=ev.getMessage().getContentDisplay();
}
if (lastMessageCount==2) {
ev.getChannel().sendMessage(ev.getMessage().getContentDisplay())
.queue();
}
}
if (ValidMessage(ev.getAuthor(),ev.getChannel(),ev.getMessage().getContentDisplay())) { if (ValidMessage(ev.getAuthor(),ev.getChannel(),ev.getMessage().getContentDisplay())) {
/*ev.getChannel().sendMessage(ev.getAuthor().getName()+" typed '"+ev.getMessage().getContentDisplay()+"'!") /*ev.getChannel().sendMessage(ev.getAuthor().getName()+" typed '"+ev.getMessage().getContentDisplay()+"'!")
.queue();*/ .queue();*/
@ -79,14 +94,18 @@ public class DivaBot extends ListenerAdapter{
public boolean ValidMessage(User author,MessageChannel channel,String message) { public boolean ValidMessage(User author,MessageChannel channel,String message) {
return (author==null||author.getIdLong()!=809417111859888168l) return (author==null||author.getIdLong()!=809417111859888168l)
&&(channel.getName().equalsIgnoreCase("bot-tests")|| &&(ApprovedChannel(channel,author))
channel.getIdLong()==772923108997857291l/*D4DJcord tiering channel*/||
channel.getName().equalsIgnoreCase(author.getName()))
&&(ContainsMoreThanJustEmote(message) && (message.toLowerCase().contains("muni")|| &&(ContainsMoreThanJustEmote(message) && (message.toLowerCase().contains("muni")||
message.toLowerCase().contains("むに")|| message.toLowerCase().contains("むに")||
message.toLowerCase().contains("무니"))); message.toLowerCase().contains("무니")));
} }
private boolean ApprovedChannel(MessageChannel channel,User author) {
return channel.getName().equalsIgnoreCase("bot-tests")||
channel.getIdLong()==772923108997857291l/*D4DJcord tiering channel*/||
channel.getName().equalsIgnoreCase(author.getName());
}
private boolean ContainsMoreThanJustEmote(String message) { private boolean ContainsMoreThanJustEmote(String message) {
int colonCount=0; int colonCount=0;
for (int i=0;i<message.length();i++) { for (int i=0;i<message.length();i++) {

Loading…
Cancel
Save