From f924dd8fcaeca7523289b9aba46b6145c46b42dd Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 5 Sep 2023 11:38:26 -0400 Subject: rename /use to /send, add resetcmd --- commands/add.js | 10 +++++----- commands/preview.js | 2 +- commands/send.js | 16 ++++++++++++++++ commands/use.js | 16 ---------------- help.md | 2 +- resetcmd.js | 10 ++++++++++ 6 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 commands/send.js delete mode 100644 commands/use.js create mode 100644 resetcmd.js diff --git a/commands/add.js b/commands/add.js index 5d74b6a..0fbdb56 100644 --- a/commands/add.js +++ b/commands/add.js @@ -3,10 +3,10 @@ const { SlashCommandBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('add') - .setDescription('Add a Command') + .setDescription('Add a command') .addStringOption(option => - option.setName('command') - .setDescription('The name of the command `/use THIS`') + option.setName('name') + .setDescription('The name of the command `/send THIS`') .setRequired(true)) .addStringOption(option => option.setName('content') @@ -15,8 +15,8 @@ module.exports = { async execute(interaction) { if (global.data.getList().length <= 25) { - global.data.add(interaction.options.getString('command'),interaction.options.getString('content')); - await interaction.reply('Added `'+interaction.options.getString('command')+'`.'); + global.data.add(interaction.options.getString('name'),interaction.options.getString('content')); + await interaction.reply('Added `'+interaction.options.getString('name')+'`.'); } else { diff --git a/commands/preview.js b/commands/preview.js index 013f650..3ca6780 100644 --- a/commands/preview.js +++ b/commands/preview.js @@ -6,7 +6,7 @@ module.exports = { .setDescription('Only you can see this!') .addStringOption(option => option.setName('command') - .setDescription('Name of the command to display') + .setDescription('Name of the command to preview') .setRequired(true) .addChoices(...global.data.getList()) ), diff --git a/commands/send.js b/commands/send.js new file mode 100644 index 0000000..a339784 --- /dev/null +++ b/commands/send.js @@ -0,0 +1,16 @@ +const { SlashCommandBuilder } = require('discord.js'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('send') + .setDescription('Send a command') + .addStringOption(option => + option.setName('command') + .setDescription('Name of the command to send') + .setRequired(true) + .addChoices(...global.data.getList()) + ), + async execute(interaction) { + await interaction.reply(global.data.get(interaction.options.getString('command'))); + }, +}; \ No newline at end of file diff --git a/commands/use.js b/commands/use.js deleted file mode 100644 index dc9897b..0000000 --- a/commands/use.js +++ /dev/null @@ -1,16 +0,0 @@ -const { SlashCommandBuilder } = require('discord.js'); - -module.exports = { - data: new SlashCommandBuilder() - .setName('use') - .setDescription('Use a Command') - .addStringOption(option => - option.setName('command') - .setDescription('What the bot will send') - .setRequired(true) - .addChoices(...global.data.getList()) - ), - async execute(interaction) { - await interaction.reply(global.data.get(interaction.options.getString('command'))); - }, -}; \ No newline at end of file diff --git a/help.md b/help.md index f824c1c..717e373 100644 --- a/help.md +++ b/help.md @@ -1,5 +1,5 @@ # welcome to sowbot 3! -- To use a command, type `/use` then the name of the command. A list of available commands should appear. +- To use a command, type `/send` then the name of the command. A list of available commands should appear. - To preview a command (only you see it) run `/preview` then the name of the command. A list of available commands should appear. - To add a command type `/add`. In the name field, put the name of the command. In the content field put the image link or whatever else you want the bot to send. - To remove a command type `/remove` then the name of the command. A list of available commands should appear. diff --git a/resetcmd.js b/resetcmd.js new file mode 100644 index 0000000..e11e54a --- /dev/null +++ b/resetcmd.js @@ -0,0 +1,10 @@ +const { REST, Routes } = require('discord.js'); +const { clientId, token } = require('./config.json'); + +// Construct and prepare an instance of the REST module +const rest = new REST().setToken(token); + +// and deploy your commands! +rest.put(Routes.applicationCommands(clientId), { body: [] }) + .then(() => console.log('Successfully deleted all application commands.')) + .catch(console.error); \ No newline at end of file -- cgit v1.2.3