public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { if (arguments.Count != 1) { response = string.Format(DiscordIntegration.Language.InvalidParametersError, 1); return(false); } if (!sender.CheckPermission("di.remove.role")) { response = string.Format(DiscordIntegration.Language.NotEnoughPermissions, "di.remove.role"); return(false); } if (!DiscordIntegration.Network.IsConnected) { response = DiscordIntegration.Language.BotIsNotConnectedError; return(false); } if (!arguments.At(0).IsValidDiscordRoleId()) { response = string.Format(DiscordIntegration.Language.InvalidDiscordRoleIdError, arguments.At(0)); return(false); } _ = DiscordIntegration.Network.SendAsync(new RemoteCommand("removeRole", arguments.At(0), sender.GetCompatible())); response = DiscordIntegration.Language.RemoveRoleCommandSuccess; return(false); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { if (arguments.Count != 0) { response = string.Format(DiscordIntegration.Language.InvalidParametersError, 0); return(false); } if (!sender.CheckPermission("di.reload.syncedroles")) { response = string.Format(DiscordIntegration.Language.NotEnoughPermissions, "di.reload.syncedroles"); return(false); } if (!DiscordIntegration.Network.IsConnected) { response = DiscordIntegration.Language.BotIsNotConnectedError; return(false); } DiscordIntegration.Instance.SyncedUsersCache.Clear(); _ = DiscordIntegration.Network.SendAsync(new RemoteCommand("loadSyncedRoles", sender.GetCompatible())); response = DiscordIntegration.Language.ReloadSyncedRolesSuccess; return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { if (arguments.Count != 2) { response = string.Format(Language.InvalidParametersError, 2); return(false); } if (!sender.CheckPermission("di.add.role")) { response = string.Format(Language.NotEnoughPermissions, "di.add.role"); return(false); } if (!Network.IsConnected) { response = Language.BotIsNotConnectedError; return(false); } if (!arguments.At(0).IsValidDiscordRoleId()) { response = string.Format(Language.InvalidDiscordRoleIdError, arguments.At(0)); return(false); } if (ServerStatic.PermissionsHandler.GetGroup(arguments.At(1)) == null) { response = string.Format(Language.InvalidGroupError, arguments.At(1)); return(false); } _ = Network.SendAsync(new RemoteCommand("addRole", arguments.At(0), arguments.At(1), sender.GetCompatible())); response = Language.AddRoleCommandSuccess; return(false); }