Example #1
0
        public async Task SendDiscordMessageAsync(ulong chanId, DisukuUser user)
        {
            var formattedRoles = new StringBuilder();

            foreach (var role in user.Roles)
            {
                if (role.Name == "@everyone")
                {
                    formattedRoles.Append($"{role.Name}, "); continue;
                }
                formattedRoles.Append($"<@&{role.Id}>, ");
            }

            var embed = new DisukuEmbed
            {
                Title       = $"Profile: {user.Username}",
                Description =
                    $"**User ID:** {user.UserId}\n" +
                    $"**Guild ID:** {user.GuildId}\n" +
                    $"**Account Created:** {user.CreatedAt}\n" +
                    $"**Joined Server:** {user.JoinedAt}\n" +
                    "**Roles:**\n" +
                    $"{formattedRoles}",
                Thumbnail = user.AvatarUrl
            };

            await SendDiscordEmbedAsync(chanId, embed);
        }
Example #2
0
        public async Task List(ulong chanId, DisukuUser user)
        {
            var sb     = new StringBuilder();
            var quotes = await _dataStore.LoadRecordsAsync <Quote>(x => x.AuthorId == user.UserId, TableName);

            if (quotes is null || !quotes.Any())
            {
                await _discordMessage.SendDiscordMessageAsync(chanId, "No results found.");

                return;
            }

            foreach (var quote in quotes)
            {
                sb.Append($"AuthorUsername: {quote.AuthorUsername}\n" +
                          $"Quote: {quote.Name}\n" +
                          $"Id: {quote.MessageId}\n\n");
            }
            await _discordMessage.SendDiscordMessageAsync(chanId, $"{sb}");
        }
 public async Task ReplyUserAsync(ulong chanId, DisukuUser user)
 {
     await _discordMessage.SendDiscordMessageAsync(chanId, user);
 }