From 9f974d578f471113fc42a03e64cbfbc9ec27f4e4 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sat, 18 Dec 2021 20:54:43 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=20getNoun=20=D0=B2=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Moderation/clear.js | 13 ++++++++++++- languages/ru-RU/moderation/clear.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index ab03e633..7b8b6627 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -64,4 +64,15 @@ class Clear extends Command { } }; -module.exports = Clear; \ No newline at end of file +module.exports = Clear; + +function getNoun(number, one, two, five) { + let n = Math.abs(number); + n %= 100; + if (n >= 5 && n <= 20) return five; + n %= 10; + if (n === 1) return one; + if (n >= 2 && n <= 4) return two; + + return five; +}; \ No newline at end of file diff --git a/languages/ru-RU/moderation/clear.json b/languages/ru-RU/moderation/clear.json index 28d61cec..6939f05a 100644 --- a/languages/ru-RU/moderation/clear.json +++ b/languages/ru-RU/moderation/clear.json @@ -5,6 +5,6 @@ "MISSING_AMOUNT": "Укажите кол-во сообщений для удаления!", "ALL_CONFIRM": "Все сообщения в канале будут удалены! Введите `confirm` для подтверждения", "CHANNEL_CLEARED": "Канал очищен!", - "CLEARED": "**{{amount}}** сообщений было удалено!", + "CLEARED": "**{{amount}}** getNoun({{amount}}, \"сообщение\", \"сообщения\", \"сообщений\") было удалено!", "CLEARED_MEMBER": "**{{amount}}** сообщений от **{{username}}** было удалено!" } \ No newline at end of file