From 26205d1416c92b3c1524e6c7f3762db6fd4523f5 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Tue, 27 Sep 2022 12:48:23 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20giveaw?= =?UTF-8?q?ay,=20=D0=B4=D0=BE=D0=BB=D0=B6=D0=BD=D0=BE=20=D0=B1=D1=8B=D1=82?= =?UTF-8?q?=D1=8C=20=D1=83=D0=B4=D0=BE=D0=B1=D0=BD=D0=B5=D0=B5=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Moderation/giveaway.js | 34 +++++++++++++++--------- languages/ru-RU/moderation/giveaway.json | 4 +++ 2 files changed, 26 insertions(+), 12 deletions(-) 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": "Количество победителей",