aboutsummaryrefslogtreecommitdiff
path: root/examples/discord-interactions/commands/hello.js
diff options
context:
space:
mode:
authorGravatar evanwashere <github@evan.lol> 2022-07-05 11:23:40 -0400
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-07-05 09:26:58 -0700
commit4a927e09b7cb3c22560599184c675bb185535f60 (patch)
tree8666d315b2d389a9cf9ace02e2c9b7ed83abeadb /examples/discord-interactions/commands/hello.js
parenta577e3507fadc5822e060ee3a8894d4d60b45e49 (diff)
downloadbun-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.js21
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