Multi guild for daily madame
This commit is contained in:
parent
c06bdcd21a
commit
38eb8c39f7
@ -4,11 +4,13 @@ import net.Broken.Commands.Over18.Madame;
|
|||||||
import net.Broken.MainBot;
|
import net.Broken.MainBot;
|
||||||
import net.Broken.Tools.DayListener.NewDayListener;
|
import net.Broken.Tools.DayListener.NewDayListener;
|
||||||
import net.Broken.Tools.Redirection;
|
import net.Broken.Tools.Redirection;
|
||||||
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
import net.dv8tion.jda.core.entities.TextChannel;
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daily Listener for DailyMadame
|
* Daily Listener for DailyMadame
|
||||||
@ -21,7 +23,18 @@ public class DailyMadame implements NewDayListener{
|
|||||||
boolean success=false;
|
boolean success=false;
|
||||||
boolean error=false;
|
boolean error=false;
|
||||||
int errorCp=0;
|
int errorCp=0;
|
||||||
TextChannel chanel = MainBot.jda.getTextChannelsByName("nsfw-over18", true).get(0);
|
List<Guild> guilds = MainBot.jda.getGuilds();
|
||||||
|
|
||||||
|
for(Guild guild : guilds){
|
||||||
|
TextChannel chanel = null;
|
||||||
|
for(TextChannel iterator : guild.getTextChannels())
|
||||||
|
{
|
||||||
|
if(iterator.isNSFW()){
|
||||||
|
chanel = iterator;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(chanel != null){
|
||||||
while(!success && !error)
|
while(!success && !error)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -48,4 +61,12 @@ public class DailyMadame implements NewDayListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
logger.info("No NSFW chanel found for " + guild.getName() + ", ignoring it!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user