Beispiel #1
0
        public async Task AllowRole(CommandContext ctx, string node, DiscordRole role)
        {
            await ctx.TriggerTypingAsync();

            if (!await this.CheckPermission(_permissionService, typeof(PermissionsCommands), nameof(PermissionsCommands.AllowRole), ctx.Member))
            {
                await ctx.RespondAsync("You are not permitted to use this command.");

                return;
            }

            Permission permission;

            try
            {
                permission = await _permissionService.AllowNodeForRoleAsync(ctx.Guild.Id, role.Id, node);
            }
            catch (PermissionNodeNotFoundException)
            {
                await ctx.RespondAsync("Permission node not found.");

                return;
            }

            await ctx.RespondAsync($"Allowed permission {permission.Node} for role {role.Name}.");
        }