Пример #1
0
        public async Task RemoveWebAdminAccessAsync(SocketGuild guild, SocketUser user)
        {
            var entity = await GrillBotRepository.UsersRepository.GetUserAsync(guild.Id, user.Id, UsersIncludes.None);

            if (string.IsNullOrEmpty(entity?.WebAdminPassword))
            {
                throw new InvalidOperationException($"Uživatel `{user.GetFullName()}` nemá přístup do administrace.");
            }

            entity.WebAdminPassword = null;
            await GrillBotRepository.CommitAsync();
        }
Пример #2
0
        private Embed CreateEmbed(List <EmbedFieldBuilder> fields, SocketUser user, int pageNumber)
        {
            var builder = new EmbedBuilder()
            {
                Color        = Color.Blue,
                Title        = $"Nápověda pro uživatele {user.GetFullName()} ({GetBotBestPermissions(user)})",
                Fields       = fields,
                ThumbnailUrl = Context.Client.CurrentUser.GetUserAvatarUrl()
            };

            builder
            .WithFooter($"Odpověď pro {user.GetShortName()} | Strana {pageNumber}", user.GetUserAvatarUrl())
            .WithCurrentTimestamp();

            return(builder.Build());
        }