diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index f9c41ad6..0fd1c13d 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -17,7 +17,7 @@ class Giveaway extends BaseCommand { .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))) .addStringOption(option => option.setName("duration") .setDescription(client.translate("common:DURATION"))) - .addStringOption(option => option.setName("winners_count") + .addIntegerOption(option => option.setName("winners_count") .setDescription(client.translate("moderation/giveaway:WINNERS_COUNT"))) .addStringOption(option => option.setName("prize") .setDescription(client.translate("moderation/giveaway:PRIZE"))) @@ -42,19 +42,29 @@ class Giveaway extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const options = ["create", "reroll", "delete", "end"].map(tag => - JSON.parse(JSON.stringify({ - label: tag, - value: tag - })) - ); - const row = new ActionRowBuilder() .addComponents( new SelectMenuBuilder() .setCustomId("giveaway_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(options) + .addOptions([ + { + label: interaction.translate("moderation/giveaway:CREATE"), + value: "create" + }, + { + label: interaction.translate("moderation/giveaway:REROLL"), + value: "reroll" + }, + { + label: interaction.translate("moderation/giveaway:DELETE"), + value: "delete" + }, + { + label: interaction.translate("moderation/giveaway:END"), + value: "end" + } + ]) ); const msg = await interaction.reply({ @@ -83,13 +93,13 @@ class Giveaway extends BaseCommand { if (!duration) return i.update({ content: interaction.translate("moderation/giveaway:INVALID_CREATE") }); if (ms(duration) > ms("10d")) return i.update({ content: interaction.translate("moderation/giveaway:MAX_DURATION") }); - const winnersCount = interaction.options.getString("winners_count"); + const winnersCount = interaction.options.getInteger("winners_count"); if (!winnersCount) return i.update({ content: interaction.translate("moderation/giveaway:INVALID_CREATE") }); - if (isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1) return i.update({ content: interaction.translate("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }) }); + if (winnersCount > 10 || winnersCount < 1) return i.update({ content: interaction.translate("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }) }); const prize = interaction.options.getString("prize"); if (!prize) return i.update({ content: interaction.translate("moderation/giveaway:INVALID_CREATE") }); - const isdrop = interaction.options.getString("isdrop"); + const isdrop = interaction.options.getBoolean("isdrop"); client.giveawaysManager.start(interaction.channel, { duration: ms(duration), diff --git a/languages/ru-RU/moderation/giveaway.json b/languages/ru-RU/moderation/giveaway.json index 19980b20..a15e8793 100644 --- a/languages/ru-RU/moderation/giveaway.json +++ b/languages/ru-RU/moderation/giveaway.json @@ -2,6 +2,10 @@ "DESCRIPTION": "Управление раздачами", "USAGE": "[create/reroll/delete/end] [время] [кол-во победителей] [приз] (Дроп?)", "EXAMPLES": "giveaway create 1d 2 Discord Нитро!\ngiveaway create 1d 2 true Discord Нитро\ngiveaway reroll 597812898022031374", + "CREATE": "Создать", + "REROLL": "Заролить снова", + "DELETE": "Удалить", + "END": "Закончить принудительно", "INVALID_CREATE": "Какой-то из аргументов указан неверно, попробуйте снова!", "GIVEAWAY_ID": "ID сообщения раздачи", "WINNERS_COUNT": "Количество победителей",