use of github.scarsz.discordsrv.dependencies.jda.api.Permission in project InteractiveChat-DiscordSRV-Addon by LOOHP.
the class DiscordReadyEvents method ready.
public void ready() {
Debug.debug("Triggering discord ready...");
DiscordSRV discordsrv = InteractiveChatDiscordSrvAddon.discordsrv;
JDA jda = discordsrv.getJda();
jda.addEventListener(new OutboundToDiscordEvents.JDAEvents());
DiscordCommands discordCommands = new DiscordCommands(discordsrv);
jda.addEventListener(discordCommands);
Bukkit.getPluginManager().registerEvents(discordCommands, InteractiveChatDiscordSrvAddon.plugin);
for (String channelId : discordsrv.getChannels().values()) {
if (channelId != null) {
try {
GuildChannel channel = jda.getGuildChannelById(channelId);
if (channel != null) {
Guild guild = channel.getGuild();
Member self = guild.getMember(jda.getSelfUser());
for (Permission permission : InteractiveChatDiscordSrvAddon.requiredPermissions) {
if (!self.hasPermission(channel, permission)) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[ICDiscordSrvAddon] DiscordSRV Bot is missing the \"" + permission.getName() + "\" permission in the channel \"" + channel.getName() + "\" (Id: " + channel.getId() + ")");
}
}
}
} catch (Exception e) {
new RuntimeException("Error when getting guild from channelId (" + channelId + ")", e).printStackTrace();
}
}
}
}
Aggregations