use of de.nikos410.discordbot.framework.annotations.CommandSubscriber in project de-DiscordBot by DACH-Discord.
the class UserLog method command_setUserlogChannel.
@CommandSubscriber(command = "setUserlogChannel", help = "Kanal für Userlog ändern", permissionLevel = PermissionLevel.ADMIN)
public void command_setUserlogChannel(final IMessage message, final String channel) {
final IChannel modlogChannel;
final List<IChannel> channelMentions = message.getChannelMentions();
if (GuildUtils.channelExists(message.getGuild(), channel)) {
// Kanal ID wurde als Parameter angegeben
modlogChannel = message.getGuild().getChannelByID(Long.parseLong(channel));
} else if (channelMentions.size() == 1) {
// ein Kanal wurde erwähnt
modlogChannel = channelMentions.get(0);
} else {
// Kein Kanal angegeben
DiscordIO.sendMessage(message.getChannel(), "Kein gültiger Kanal angegeben!");
return;
}
final IGuild guild = message.getGuild();
final JSONObject guildJSON = getJSONForGuild(guild);
guildJSON.put("channel", modlogChannel.getLongID());
saveUserLogJSON();
// :white_check_mark:
message.addReaction(ReactionEmoji.of("✅"));
}
use of de.nikos410.discordbot.framework.annotations.CommandSubscriber in project de-DiscordBot by DACH-Discord.
the class UserLog method command_enableUserlog.
@CommandSubscriber(command = "enableUserlog", help = "Userlog aktivieren", permissionLevel = PermissionLevel.ADMIN)
public void command_enableUserlog(final IMessage message) {
final IGuild guild = message.getGuild();
final JSONObject guildJSON = getJSONForGuild(guild);
if (!guildJSON.has("channel")) {
DiscordIO.sendMessage(message.getChannel(), "Es ist noch kein Kanal hinterlegt!");
}
guildJSON.put("on", true);
saveUserLogJSON();
// :white_check_mark:
message.addReaction(ReactionEmoji.of("✅"));
}
Aggregations