mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-13 23:53:08 +02:00
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
const { SlashCommand } = require('@eartharoid/dbf');
|
|
const { ApplicationCommandOptionType } = require('discord.js');
|
|
const { useGuild } = require('../../lib/tickets/utils');
|
|
|
|
module.exports = class NewSlashCommand extends SlashCommand {
|
|
constructor(client, options) {
|
|
const name = 'new';
|
|
super(client, {
|
|
...options,
|
|
description: client.i18n.getMessage(null, `commands.slash.${name}.description`),
|
|
descriptionLocalizations: client.i18n.getAllMessages(`commands.slash.${name}.description`),
|
|
dmPermission: false,
|
|
name,
|
|
nameLocalizations: client.i18n.getAllMessages(`commands.slash.${name}.name`),
|
|
options: [
|
|
{
|
|
autocomplete: true,
|
|
name: 'references',
|
|
required: false,
|
|
type: ApplicationCommandOptionType.String,
|
|
},
|
|
].map(option => {
|
|
option.descriptionLocalizations = client.i18n.getAllMessages(`commands.slash.${name}.options.${option.name}.description`);
|
|
option.description = option.descriptionLocalizations['en-GB'];
|
|
option.nameLocalizations = client.i18n.getAllMessages(`commands.slash.${name}.options.${option.name}.name`);
|
|
return option;
|
|
}),
|
|
});
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
*/
|
|
async run(interaction) {
|
|
await useGuild(this.client, interaction, { referencesTicketId: interaction.options.getString('references', false) });
|
|
}
|
|
}; |