DiscordTickets/src/commands/slash/force-close.js

57 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-08-02 23:13:32 +03:00
const { SlashCommand } = require('@eartharoid/dbf');
const { ApplicationCommandOptionType } = require('discord.js');
module.exports = class ForceCloseSlashCommand extends SlashCommand {
constructor(client, options) {
const descriptionLocalizations = {};
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.force-close.description')));
const nameLocalizations = {};
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.force-close.name')));
let opts = [
{
2022-10-06 14:49:38 +03:00
name: 'reason',
2022-08-02 23:13:32 +03:00
required: false,
2022-10-06 14:49:38 +03:00
type: ApplicationCommandOptionType.String,
2022-08-02 23:13:32 +03:00
},
{
2022-10-06 14:49:38 +03:00
autocomplete: true,
name: 'ticket',
2022-08-02 23:13:32 +03:00
required: false,
type: ApplicationCommandOptionType.Integer,
},
{
name: 'time',
required: false,
type: ApplicationCommandOptionType.String,
},
];
opts = opts.map(o => {
const descriptionLocalizations = {};
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.force-close.options.${o.name}.description`)));
const nameLocalizations = {};
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.force-close.options.${o.name}.name`)));
return {
...o,
description: descriptionLocalizations['en-GB'],
descriptionLocalizations,
nameLocalizations: nameLocalizations,
};
});
super(client, {
...options,
description: descriptionLocalizations['en-GB'],
descriptionLocalizations,
dmPermission: false,
name: nameLocalizations['en-GB'],
nameLocalizations,
options: opts,
});
}
async run(interaction) { }
};