diff options
author | 2022-07-05 11:23:40 -0400 | |
---|---|---|
committer | 2022-07-05 09:26:58 -0700 | |
commit | 4a927e09b7cb3c22560599184c675bb185535f60 (patch) | |
tree | 8666d315b2d389a9cf9ace02e2c9b7ed83abeadb /examples/discord-interactions/commands/hello.js | |
parent | a577e3507fadc5822e060ee3a8894d4d60b45e49 (diff) | |
download | bun-4a927e09b7cb3c22560599184c675bb185535f60.tar.gz bun-4a927e09b7cb3c22560599184c675bb185535f60.tar.zst bun-4a927e09b7cb3c22560599184c675bb185535f60.zip |
discord interactions template
Diffstat (limited to 'examples/discord-interactions/commands/hello.js')
-rw-r--r-- | examples/discord-interactions/commands/hello.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/discord-interactions/commands/hello.js b/examples/discord-interactions/commands/hello.js new file mode 100644 index 000000000..61d92cf82 --- /dev/null +++ b/examples/discord-interactions/commands/hello.js @@ -0,0 +1,21 @@ +const { SlashCommand, CommandOptionType } = require('slash-create'); + +module.exports = class HelloCommand extends SlashCommand { + constructor(creator) { + super(creator, { + name: 'hello', + description: 'Says hello to you.', + options: [{ + type: CommandOptionType.STRING, + name: 'food', + description: 'What food do you like?' + }] + }); + + this.filePath = __filename; + } + + async run(ctx) { + return ctx.options.food ? `You like ${ctx.options.food}? Nice!` : `Hello, ${ctx.user.username}!`; + } +}
\ No newline at end of file |