summaryrefslogtreecommitdiff
path: root/commands/add.js
blob: 0fbdb563e4c309a12cb6ff0201bc3241b76d04cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
	data: new SlashCommandBuilder()
		.setName('add')
		.setDescription('Add a command')
        .addStringOption(option =>
            option.setName('name')
                .setDescription('The name of the command `/send THIS`')
                .setRequired(true))
        .addStringOption(option =>
            option.setName('content')
                .setDescription('What the bot will send')
                .setRequired(true)),
	async execute(interaction) {
        if (global.data.getList().length <= 25)
        {
            global.data.add(interaction.options.getString('name'),interaction.options.getString('content'));
            await interaction.reply('Added `'+interaction.options.getString('name')+'`.');
        }
        else
        {
            await interaction.reply('Failed to add command. There is a hard limit of 25 commands!');
        }
	},
};