use of de.nikos410.discordbot.framework.PermissionLevel in project de-DiscordBot by DACH-Discord.
the class ModStuff method command_Unmute.
@CommandSubscriber(command = "unmute", help = "Nutzer entmuten", pmAllowed = false, permissionLevel = CommandPermissions.MODERATOR)
public void command_Unmute(final IMessage message) {
final List<IUser> mentions = message.getMentions();
if (mentions.size() < 1) {
Util.sendMessage(message.getChannel(), ":x: Fehler: Kein Nutzer angegeben!");
return;
} else if (mentions.size() > 1) {
Util.sendMessage(message.getChannel(), ":x: Fehler: mehrere Nutzer erwähnt");
return;
}
final IUser muteUser = mentions.get(0);
if (!mutedUsers.containsKey(muteUser.getStringID())) {
// Nutzer ist nicht gemuted
Util.sendMessage(message.getChannel(), "Nutzer scheint nicht gemuted zu sein.");
return;
}
ScheduledFuture future = mutedUsers.get(muteUser.getStringID());
future.cancel(false);
IRole muteRole = message.getGuild().getRoleByID(muteRoleID);
muteUser.removeRole(muteRole);
// :white_check_mark:
message.addReaction(ReactionEmoji.of("✅"));
}
use of de.nikos410.discordbot.framework.PermissionLevel in project de-DiscordBot by DACH-Discord.
the class UserLog method command_Userlog_Test.
@CommandSubscriber(command = "userlog_test", help = "Userlog-Ausgabe testen", permissionLevel = CommandPermissions.ADMIN)
public void command_Userlog_Test(final IMessage message) {
final IUser user = message.getAuthor();
userJoinNotify(user);
userLeaveNotify(user);
userBanNotify(user);
}
use of de.nikos410.discordbot.framework.PermissionLevel in project de-DiscordBot by DACH-Discord.
the class ModStuff method command_voicelog.
@CommandSubscriber(command = "voicelog", help = "Die letzten 20 Aktivitäten in Sprachkanälen auflisten", pmAllowed = false, permissionLevel = PermissionLevel.MODERATOR, ignoreParameterCount = true)
public void command_voicelog(final IMessage message, final String listCountArg) {
final int listCount;
if (listCountArg == null) {
listCount = 20;
} else {
try {
listCount = Integer.parseInt(listCountArg);
} catch (NumberFormatException e) {
DiscordIO.sendMessage(message.getChannel(), ":x: Die angegebene Anzahl ist keine gültige Zahl!");
return;
}
}
final List<String> guildVoiceLog = getVoiceLogForGuild(message.getGuild());
final StringBuilder stringBuilder = new StringBuilder();
boolean entriesSkipped = false;
for (int i = guildVoiceLog.size() - 1; i > (guildVoiceLog.size() - listCount - 1) && i >= 0; i--) {
final String lineToAdd = guildVoiceLog.get(i);
if (stringBuilder.length() + lineToAdd.length() <= 1024) {
stringBuilder.append(guildVoiceLog.get(i));
stringBuilder.append(String.format("%n"));
} else {
entriesSkipped = true;
}
}
final EmbedBuilder responseBuilder = new EmbedBuilder();
final String content = stringBuilder.length() > 0 ? stringBuilder.toString() : "_keine_";
responseBuilder.appendField(String.format("__Die letzten %s Voice-Interaktionen (von neu nach alt)__", listCount), content, false);
if (entriesSkipped) {
responseBuilder.withFooterText("Einer oder mehrere Einträge wurden ignoriert, weil die maximale Textlänge erreicht wurde.");
}
DiscordIO.sendEmbed(message.getChannel(), responseBuilder.build());
}
use of de.nikos410.discordbot.framework.PermissionLevel in project de-DiscordBot by DACH-Discord.
the class ModStuff method command_setModlogChannel.
@CommandSubscriber(command = "setModlogChannel", help = "Kanal in dem die Modlog Nachrichten gesendet werden einstellen", pmAllowed = false, passContext = false, permissionLevel = PermissionLevel.ADMIN)
public void command_setModlogChannel(final IMessage message, final String channelParameter) {
final IChannel modlogChannel = ChannelUtils.getChannelFromMessage(message, channelParameter);
if (modlogChannel == null) {
// No valid channel was specified
DiscordIO.sendMessage(message.getChannel(), "Kein gültiger Kanal angegeben!");
return;
}
final IGuild guild = message.getGuild();
final JSONObject guildJSON;
if (modstuffJSON.has(guild.getStringID())) {
guildJSON = modstuffJSON.getJSONObject(guild.getStringID());
} else {
guildJSON = new JSONObject();
modstuffJSON.put(guild.getStringID(), guildJSON);
}
guildJSON.put("modlogChannel", modlogChannel.getLongID());
saveJSON();
// :white_check_mark:
message.addReaction(ReactionEmoji.of("✅"));
}
use of de.nikos410.discordbot.framework.PermissionLevel in project de-DiscordBot by DACH-Discord.
the class ModStuff method command_setMuteRole.
@CommandSubscriber(command = "setMuteRole", help = "Mute Rolle einstellen", pmAllowed = false, passContext = false, permissionLevel = PermissionLevel.ADMIN)
public void command_setMuteRole(final IMessage message, final String roleParameter) {
final IRole muteRole = GuildUtils.getRoleFromMessage(message, roleParameter);
if (muteRole == null) {
// No valid role specified
DiscordIO.sendMessage(message.getChannel(), "Keine gültige Rolle angegeben!");
return;
}
final IGuild guild = message.getGuild();
final JSONObject guildJSON;
if (modstuffJSON.has(guild.getStringID())) {
guildJSON = modstuffJSON.getJSONObject(guild.getStringID());
} else {
guildJSON = new JSONObject();
modstuffJSON.put(guild.getStringID(), guildJSON);
}
guildJSON.put("muteRole", muteRole.getLongID());
saveJSON();
// :white_check_mark:
message.addReaction(ReactionEmoji.of("✅"));
}
Aggregations