DiscordTickets/src/commands/slash/move.js

51 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-08-02 23:29:44 +03:00
const { SlashCommand } = require('@eartharoid/dbf');
const { ApplicationCommandOptionType } = require('discord.js');
2022-10-16 16:07:10 +03:00
module.exports = class MoveSlashCommand extends SlashCommand {
2022-08-02 23:29:44 +03:00
constructor(client, options) {
const descriptionLocalizations = {};
2022-10-16 16:07:10 +03:00
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.move.description')));
2022-08-02 23:29:44 +03:00
const nameLocalizations = {};
2022-10-16 16:07:10 +03:00
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.move.name')));
2022-08-02 23:29:44 +03:00
let opts = [
{
autocomplete: true,
name: 'category',
required: true,
type: ApplicationCommandOptionType.Integer,
2022-08-02 23:29:44 +03:00
},
];
opts = opts.map(o => {
const descriptionLocalizations = {};
2022-10-16 16:07:10 +03:00
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.move.options.${o.name}.description`)));
2022-08-02 23:29:44 +03:00
const nameLocalizations = {};
2022-10-16 16:07:10 +03:00
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.move.options.${o.name}.name`)));
2022-08-02 23:29:44 +03:00
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,
});
}
2022-08-10 21:50:19 +03:00
async run(interaction) {
// TODO: check discordCategory max but not category max (ignore)
// TODO: update cached count for both categories and category-members (from and to)
}
};