-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathContextCommands.cs
70 lines (59 loc) · 2.87 KB
/
ContextCommands.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace Cliptok.Commands.InteractionCommands
{
internal class ContextCommands : ApplicationCommandModule
{
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Show Avatar", defaultPermission: true)]
public async Task ContextAvatar(ContextMenuContext ctx)
{
string avatarUrl = await LykosAvatarMethods.UserOrMemberAvatarURL(ctx.TargetUser, ctx.Guild);
DiscordEmbedBuilder embed = new DiscordEmbedBuilder()
.WithColor(new DiscordColor(0xC63B68))
.WithTimestamp(DateTime.UtcNow)
.WithImageUrl(avatarUrl)
.WithAuthor(
$"Avatar for {ctx.TargetUser.Username} (Click to open in browser)",
avatarUrl
);
await ctx.RespondAsync(null, embed, ephemeral: true);
}
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Show Notes", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(permissions: DiscordPermission.ModerateMembers)]
public async Task ShowNotes(ContextMenuContext ctx)
{
await ctx.RespondAsync(embed: await UserNoteHelpers.GenerateUserNotesEmbedAsync(ctx.TargetUser), ephemeral: true);
}
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Show Warnings", defaultPermission: true)]
public async Task ContextWarnings(ContextMenuContext ctx)
{
await ctx.RespondAsync(embed: await WarningHelpers.GenerateWarningsEmbedAsync(ctx.TargetUser), ephemeral: true);
}
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "User Information", defaultPermission: true)]
public async Task ContextUserInformation(ContextMenuContext ctx)
{
await ctx.RespondAsync(embed: await DiscordHelpers.GenerateUserEmbed(ctx.TargetUser, ctx.Guild), ephemeral: true);
}
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Hug", defaultPermission: true),]
public async Task Hug(ContextMenuContext ctx)
{
var user = ctx.TargetUser;
if (user is not null)
{
switch (new Random().Next(4))
{
case 0:
await ctx.RespondAsync($"*{ctx.User.Mention} snuggles {user.Mention}*");
break;
case 1:
await ctx.RespondAsync($"*{ctx.User.Mention} huggles {user.Mention}*");
break;
case 2:
await ctx.RespondAsync($"*{ctx.User.Mention} cuddles {user.Mention}*");
break;
case 3:
await ctx.RespondAsync($"*{ctx.User.Mention} hugs {user.Mention}*");
break;
}
}
}
}
}