aboutsummaryrefslogtreecommitdiff
path: root/examples/discord-interactions/commands/hello.js
diff options
context:
space:
mode:
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