summaryrefslogtreecommitdiff
path: root/commands/add.js
blob: 5d74b6a128530e1d813bb3b5992632a2205dc07f (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('command')
                .setDescription('The name of the command `/use 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('command'),interaction.options.getString('content'));
            await interaction.reply('Added `'+interaction.options.getString('command')+'`.');
        }
        else
        {
            await interaction.reply('Failed to add command. There is a hard limit of 25 commands!');
        }
	},
};