diff options
author | 2022-07-05 12:16:52 -0400 | |
---|---|---|
committer | 2022-07-05 09:26:58 -0700 | |
commit | d3e0955ddca23bd320a7fd4afc1e1b313dc0db04 (patch) | |
tree | f762cdd39122d02b8332dffb8241436ecdcc6313 /examples/discord-interactions/commands/context_menu/avatar.js | |
parent | 5d4fbf7f020ed7134b4f447a8119e5a3718fcbb0 (diff) | |
download | bun-d3e0955ddca23bd320a7fd4afc1e1b313dc0db04.tar.gz bun-d3e0955ddca23bd320a7fd4afc1e1b313dc0db04.tar.zst bun-d3e0955ddca23bd320a7fd4afc1e1b313dc0db04.zip |
more examples
Diffstat (limited to 'examples/discord-interactions/commands/context_menu/avatar.js')
-rw-r--r-- | examples/discord-interactions/commands/context_menu/avatar.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/discord-interactions/commands/context_menu/avatar.js b/examples/discord-interactions/commands/context_menu/avatar.js new file mode 100644 index 000000000..fee1ccc68 --- /dev/null +++ b/examples/discord-interactions/commands/context_menu/avatar.js @@ -0,0 +1,21 @@ +import { SlashCommand, ApplicationCommandType } from 'slash-create'; + +export default class AvatarCommand extends SlashCommand { + constructor(creator) { + super(creator, { + // You must specify a type for context menu commands, but defaults + // to `CHAT_INPUT`, or regular slash commands. + type: ApplicationCommandType.USER, + name: 'Get Avatar URL', + }); + + this.filePath = __filename; + } + + async run(ctx) { + // The target user can be accessed from here + // You can also use `ctx.targetMember` for member properties + const target = ctx.targetUser; + return `${target.username}'s Avatar: ${target.avatarURL}`; + } +}
\ No newline at end of file |