示例#1
0
        public async Task ExcludeBase(CommandContext ctx,
                                      string action,
                                      [RemainingText]
                                      string exclude = @"")
        {
            // Check if they have the permissions to call this command.
            if (await Permissions.HandlePermissionsCheck(ctx))
            {
                switch (action)
                {
                case "new":
                case "add":
                    if (!(await FilterSystem.HasItem(exclude)))
                    {       // The exclude doesn't exist already.
                        await FilterSystem.AddExclude(ctx, exclude);
                    }
                    else
                    {       // The exclude does exist.
                        await GenericResponses.SendGenericCommandError(
                            ctx.Channel,
                            ctx.Member.Mention,
                            "Unable to add exclude",
                            $"the provided exclude `{exclude}` exists already as an exclude or mask...");
                    }
                    break;

                case "remove":
                case "delete":
                    if ((await FilterSystem.HasExclude(exclude)))
                    {       // The exclude  exists.
                        await FilterSystem.RemoveExclude(ctx, exclude);
                    }
                    else
                    {       // The exclude doesn't exist.
                        await GenericResponses.SendGenericCommandError(
                            ctx.Channel,
                            ctx.Member.Mention,
                            "Unable to remove exclude",
                            $"the provided exclude `{exclude}` exists already...");
                    }
                    break;

                case "list":
                    await FilterSystem.ListExcludes(ctx);

                    break;

                default:
                    await GenericResponses.HandleInvalidArguments(ctx);

                    break;
                }
            }
        }