From ea2cc31289d03d2ad8c7bb82173fade6b1b7943a Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 15 Apr 2017 21:10:23 +0200 Subject: [PATCH] Added an... important bit Again --- .../buttondevteam/discordplugin/commands/RoleCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/buttondevteam/discordplugin/commands/RoleCommand.java b/src/main/java/buttondevteam/discordplugin/commands/RoleCommand.java index ab9e133..b799ec7 100644 --- a/src/main/java/buttondevteam/discordplugin/commands/RoleCommand.java +++ b/src/main/java/buttondevteam/discordplugin/commands/RoleCommand.java @@ -49,6 +49,12 @@ public class RoleCommand extends DiscordCommandBase { DiscordPlugin.sendMessageToChannel(message.getChannel(), "List of game roles:\n" + DiscordPlugin.GameRoles.stream().collect(Collectors.joining("\n"))); } else if (argsa[0].equalsIgnoreCase("addrole")) { + if (!message.getAuthor().getRolesForGuild(DiscordPlugin.mainServer).stream() + .anyMatch(r -> r.getName().equals("Moderator"))) { + DiscordPlugin.sendMessageToChannel(message.getChannel(), + "You need to be a moderator to use this command."); + return; + } final List roles = (TBMCCoreAPI.IsTestServer() ? DiscordPlugin.devServer : DiscordPlugin.mainServer) .getRolesByName(argsa[1]); if (roles.size() == 0) {