Skip to content

Commit

Permalink
Add whois command
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Hook committed Jan 6, 2020
1 parent 3508475 commit 9cb1eb6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
25 changes: 22 additions & 3 deletions src/Evil.bot.ConsoleApp/Handlers/EmbedHandler.cs
Expand Up @@ -48,10 +48,29 @@ public class EmbedHandler
embed.WithTitle($"{icon} {title}");
embed.WithFooter($"{DateTime.Now:HH:mm:ss}");

if (title == "whois")
{
embed.AddField($"Mention", user.Mention, false);
embed.AddField($"Username", $"{user.Username}#{user.Discriminator}", true);
if (user.Nickname != null)
embed.AddField($"Nickname", user.Nickname, true);
embed.AddField($"ID", user.Id, true);
embed.AddField($"Status", user.Status, false);

foreach (var role in user.Roles)
{
embed.AddField($"Role", role, false);
}

embed.AddField($"Joined Server", user.JoinedAt, true);
embed.AddField($"Joined Discord", user.CreatedAt, true);
embed.WithThumbnailUrl(user.GetAvatarUrl());
return embed.Build();
}

if (title == "Guild Member Updated")
{
embed.WithDescription($"{userAfter.Mention}‎‎‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ");
embed.WithDescription($"{userAfter.Mention}‎‎‎‎‏‏‎‎");
embed.AddField($"Old Status", userBefore.Status, true);
embed.AddField($"New Status", userAfter.Status, true);
return embed.Build();
Expand All @@ -68,15 +87,15 @@ public class EmbedHandler

if (title == "User Updated")
{
embed.WithDescription($"{newUser.Mention}‎‎‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ");
embed.WithDescription($"{newUser.Mention}‎‎‎‎‏‏‎‎");
embed.AddField($"Old Username", oldUser.Status, true);
embed.AddField($"New Username", newUser.Status, true);
return embed.Build();
}

if (title == "User Voice State Updated")
{
embed.WithDescription($"{newUser.Mention}‎‎‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ");
embed.WithDescription($"{newUser.Mention}‎‎‎‎‏‏‎‎");
embed.AddField($"Old Username", oldUser.Status, true);
embed.AddField($"New Username", newUser.Status, true);
return embed.Build();
Expand Down
10 changes: 9 additions & 1 deletion src/Evil.bot.ConsoleApp/Modules/Misc/Misc.cs
Expand Up @@ -36,10 +36,18 @@ public SocketTextChannel LogChannel
[Command("echo")]
public async Task Echo([Remainder]string message)
{
//await Context.Channel.SendMessageAsync(embed: EmbedHandler.Neutral(message));
await Context.Channel.SendMessageAsync(embed: EmbedHandler.Neutral(message));
}


[Command("whois")]
[Remarks("Get detailed user information")]
public async Task WhoIs(SocketGuildUser user)
{
var title = "whois";
await Context.Channel.SendMessageAsync(embed: EmbedHandler.Info(title: title, user: user));
}

[Command("pick")]
[Remarks("Picks between given options")]
//[RequireUserPermission(GuildPermission.ManageMessages)]
Expand Down

0 comments on commit 9cb1eb6

Please sign in to comment.