Test if spam role exist
This commit is contained in:
parent
ad31172485
commit
608ae867e0
@ -118,7 +118,6 @@ public class BotListener extends ListenerAdapter {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) {
|
||||
super.onGuildVoiceLeave(event);
|
||||
|
@ -10,6 +10,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -69,6 +70,7 @@ public class AntiSpam {
|
||||
{
|
||||
MainBot.spamUtils.get(user).setOnSpam(true);
|
||||
List<Role> spm = guild.getRolesByName("Spammer", false);
|
||||
if(spm.size() != 0){
|
||||
try{
|
||||
move.exc(user, spm, true, guild, guildManager);
|
||||
MainBot.spamUtils.get(user).addMessage(event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamExtermine(user,MainBot.spamUtils.get(user.getUser()).getMultip())).complete());
|
||||
@ -83,6 +85,12 @@ public class AntiSpam {
|
||||
new MessageTimeOut(messages,MainBot.messageTimeOut).start();
|
||||
MainBot.spamUtils.get(user).setOnSpam(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nSpam role not found, you need to create it!"));
|
||||
event.getTextChannel().sendMessage(msg).complete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -122,7 +130,7 @@ public class AntiSpam {
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("["+user.getEffectiveName()+"] Démarage pour "+multip+"min");
|
||||
while (MainBot.spamUtils.get(user.getUser()).isOnSpam())
|
||||
while (MainBot.spamUtils.get(user).isOnSpam())
|
||||
{
|
||||
try {
|
||||
sleep(1000);
|
||||
@ -148,9 +156,9 @@ public class AntiSpam {
|
||||
logger.error("Hierarchy error");
|
||||
}
|
||||
logger.info("["+user.getEffectiveName()+"] Fin des "+multip+"min");
|
||||
new MessageTimeOut(new ArrayList<>(MainBot.spamUtils.get(user.getUser()).getMessages()),0).start();
|
||||
MainBot.spamUtils.get(user.getUser()).clearAndAdd(chanel.sendMessage(EmbedMessageUtils.getSpamPardon(user)).complete());
|
||||
new MessageTimeOut(MainBot.spamUtils.get(user.getUser()).getMessages(),60).start();
|
||||
new MessageTimeOut(new ArrayList<>(MainBot.spamUtils.get(user).getMessages()),0).start();
|
||||
MainBot.spamUtils.get(user).clearAndAdd(chanel.sendMessage(EmbedMessageUtils.getSpamPardon(user)).complete());
|
||||
new MessageTimeOut(MainBot.spamUtils.get(user).getMessages(),60).start();
|
||||
|
||||
// #-----------------------------------------------#
|
||||
|
||||
@ -160,4 +168,6 @@ public class AntiSpam {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user