14 |
} |
} |
15 |
|
|
16 |
async run(client: DiscordClient, message: Message | CommandInteraction, options: CommandOptions | InteractionOptions) { |
async run(client: DiscordClient, message: Message | CommandInteraction, options: CommandOptions | InteractionOptions) { |
17 |
if (!options.isInteraction && options.args[0] === undefined) { |
if (!options.isInteraction) { |
|
await message.reply(`${emoji('error')} No subcommand provided.`); |
|
|
return; |
|
|
} |
|
|
|
|
|
if (!options.isInteraction && (options.args[0] === 'send' || options.args[0] === 'schema')) { |
|
18 |
await message.reply(`${emoji('error')} This command can not be used in legacy mode. Use slash commands instead.`); |
await message.reply(`${emoji('error')} This command can not be used in legacy mode. Use slash commands instead.`); |
19 |
return; |
return; |
20 |
} |
} |
21 |
|
|
22 |
if (!options.isInteraction && !this.subcommands.includes(options.args[0])) { |
const subcommand = options.options.getSubcommand(); |
|
await message.reply(`${emoji('error')} Invalid subcommand provided. Must be one of ${this.subcommands.map(c => `\`${c}\``).join(', ')}.`); |
|
|
return; |
|
|
} |
|
|
|
|
|
const subcommand = options.isInteraction ? options.options.getSubcommand() : options.args[0]; |
|
23 |
|
|
24 |
const command = client.commands.get('embed__' + subcommand); |
const command = client.commands.get('embed__' + subcommand); |
25 |
|
|
26 |
if (command) { |
if (command) { |
|
if (!options.isInteraction) |
|
|
options.args.shift(); |
|
27 |
await command.execute(client, message, options); |
await command.execute(client, message, options); |
28 |
} |
} |
29 |
} |
} |