From af14742510f1f28d3d36d3a92b0b1f3ae4dd004e Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Wed, 5 Jan 2022 02:11:13 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=B0=D1=8F=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20-=20=D0=B4=D1=80=D0=BE=D0=BF?= =?UTF-8?q?=20=D0=B2=20giveaway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/JaBa.js | 3 +-- commands/Moderation/giveaway.js | 18 ++++++++++++++---- languages/ru-RU/moderation/giveaway.json | 11 +++++++---- package.json | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/base/JaBa.js b/base/JaBa.js index 5a739a90..2a0e6a7b 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -98,11 +98,10 @@ class JaBa extends Client { this.giveawaysManager = new GiveawaysManager(this, { storage: "./giveaways.json", - updateCountdownEvery: 10000, default: { botsCanWin: false, embedColor: this.config.embed.color, - embedColorEnd: "FF00000", + embedColorEnd: "#FF0000", reaction: "🎉" } }); diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index 44ba2c8e..01ac4767 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -8,7 +8,7 @@ class Giveaway extends Command { dirname: __dirname, enabled: true, guildOnly: true, - aliases: ["gway"], + aliases: ["gaway"], memberPermissions: ["MENTION_EVERYONE"], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, @@ -34,23 +34,33 @@ class Giveaway extends Command { if (!winnersCount) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); if (isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1) return message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }); - const prize = args.slice(3).join(" "); + var drop = (args[3] === "true"), + prize = args.slice(3).join(" "); + + if (drop) prize = args.slice(4).join(" "); + else prize = args.slice(3).join(" "); + if (!prize) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); this.client.giveawaysManager.start(message.channel, { - time: ms(time), - prize: prize, + duration: ms(time), winnerCount: parseInt(winnersCount, 10), + prize: prize, + hostedBy: message.author, + isDrop: drop, messages: { giveaway: message.translate("moderation/giveaway:TITLE"), giveawayEnded: message.translate("moderation/giveaway:ENDED"), timeRemaining: message.translate("moderation/giveaway:TIME_REMAINING"), inviteToParticipate: message.translate("moderation/giveaway:INVITE_PARTICIPATE"), winMessage: message.translate("moderation/giveaway:WIN_MESSAGE"), + drawing: message.translate("moderation/giveaway:DRAWING"), + dropMessage: message.translate("moderation/giveaway:DROP"), embedFooter: message.translate("moderation/giveaway:FOOTER"), noWinner: message.translate("moderation/giveaway:NO_WINNER"), winners: message.translate("moderation/giveaway:WINNERS"), endedAt: message.translate("moderation/giveaway:END_AT"), + hostedBy: message.translate("moderation/giveaway:HOSTEDBY"), units: { seconds: message.translate("time:SECONDS", { amount: "" diff --git a/languages/ru-RU/moderation/giveaway.json b/languages/ru-RU/moderation/giveaway.json index 2edac8f7..1fb49db0 100644 --- a/languages/ru-RU/moderation/giveaway.json +++ b/languages/ru-RU/moderation/giveaway.json @@ -1,7 +1,7 @@ { "DESCRIPTION": "Управление раздачами!", - "USAGE": "{{prefix}}giveaway [create/reroll/delete/end] (время) (кол-во победителей) (приз)", - "EXAMPLES": "{{prefix}}giveaway create 10m 2 100 рублей на карту!\n{{prefix}}giveaway reroll 597812898022031374", + "USAGE": "{{prefix}}giveaway [create/reroll/delete/end] [время] [кол-во победителей] (Дроп? true) [приз]", + "EXAMPLES": "{{prefix}}giveaway create 1d 2 100 рублей на карту!\n{{prefix}}giveaway create 1d 2 true 100 рублей на карту\n{{prefix}}giveaway reroll 597812898022031374", "MISSING_STATUS": "Выберите действие: `create`, `reroll`, `end` или `delete`!", "INVALID_CREATE": "Какой-то из аргументов указан неверно, попробуйте снова!", "MISSING_ID": "Укажите ID сообщения раздачи!", @@ -13,11 +13,14 @@ "ENDED": "🎉🎉 **РАЗДАЧА ОКОНЧЕНА** 🎉🎉", "TIME_REMAINING": "Оставшееся время: **{duration}**!", "INVITE_PARTICIPATE": "Отреагируйте 🎉, чтобы участвовать!", - "WIN_MESSAGE": "Поздравляем, {winners}! Вы выиграли **{prize}**!", + "WIN_MESSAGE": "Поздравляем, {winners}! Вы выиграли **{this.prize}**!", + "DRAWING": "Заканчивается: {timestamp}", + "DROP": "Будь первым кто отреагирует 🎉!", "FOOTER": "Раздача", "NO_WINNER": "Раздача отменена, никто не участвовал.", "WINNERS": "Победитель(и)", - "END_AT": "Заканчивается", + "END_AT": "Закончилась:", + "HOSTEDBY": "Организатор: {this.hostedBy}", "REROLL_CONGRAT": "🎉 Новый(е) побелитель(и): {winners}! Поздравляем!", "REROLL_ERROR": "Нет действительных заявок, никто не выиграл!", "GIVEAWAY_CREATED": "Раздача начата!", diff --git a/package.json b/package.json index 44cee758..c8c699da 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dblapi.js": "^2.3.0", "discord-backup": "^3.0.1", "discord-canvas": "^1.3.2", - "discord-giveaways": "^5.0.1", + "discord-giveaways": "github:Androz2091/discord-giveaways#develop", "discord-paginationembed": "github:gazmull/discord-paginationembed#v3", "discord-together": "^1.3.25", "discord.js": "^13.5.0",