Пример #1
0
        public async Task AllowUser(CommandContext ctx, string node, DiscordMember user)
        {
            await ctx.TriggerTypingAsync();

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

                return;
            }

            Permission permission;

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

                return;
            }

            await ctx.RespondAsync($"Allowed permission {permission.Node} for user {user.GetUsernameAndDiscriminator()}.");
        }