use of net.dv8tion.jda.api.entities.Guild in project Saber-Bot by notem.
the class GlobalMsgCommand method action.
@Override
public void action(String prefix, String[] args, MessageReceivedEvent event) {
String msg = "";
for (String arg : args) {
msg += arg + " ";
}
for (Guild guild : Main.getShardManager().getGuilds()) {
String channelId = Main.getGuildSettingsManager().getGuildSettings(guild.getId()).getCommandChannelId();
if (// look for default control channel name
channelId == null) {
Collection<TextChannel> chans = guild.getTextChannelsByName(Main.getBotSettingsManager().getControlChan(), true);
for (TextChannel chan : chans) {
MessageUtilities.sendMsg(msg, chan, null);
}
} else // send to configured control channel
{
MessageChannel chan = guild.getTextChannelById(channelId);
if (chan != null) {
MessageUtilities.sendMsg(msg, chan, null);
}
}
}
MessageUtilities.sendPrivateMsg("Finished sending announcements to guilds!", event.getAuthor(), null);
}
Aggregations