From 25370e9dc1f326f53f81307cb58f2502f065754a Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 16 Dec 2022 13:16:54 -0500 Subject: [PATCH] Add an invite command to share bot invite link --- commands/invite.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 commands/invite.js diff --git a/commands/invite.js b/commands/invite.js new file mode 100644 index 0000000..b9d535c --- /dev/null +++ b/commands/invite.js @@ -0,0 +1,20 @@ +/* +* Konpeki Discord Bot - Slash Command Definition File +* invite.js - Uses your bot's clientID to create and share it's own invite link +* +* Function modified from https://discordjs.guide/creating-your-bot/slash-commands.html +*/ + +const { SlashCommandBuilder } = require('discord.js'); + +// Get the clientID and bot name from the config file +const { botName, clientId } = require('../config.json'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('invite') + .setDescription(`Invite ${botName} to your own server!`), + async execute(interaction) { + await interaction.reply({ content: `Use this link to invite ${botName} (That's me!) to your own server!\nhttps://discord.com/oauth2/authorize?client_id=${clientId}&permissions=274877908992&scope=bot%20applications.commands`, ephemeral: true }); + }, +}; \ No newline at end of file