From a660a97103a333b7ca62cbb8a33838335c83b6ac Mon Sep 17 00:00:00 2001 From: tacheometry <39647014+tacheometry@users.noreply.github.com> Date: Sun, 17 Dec 2023 07:35:00 +0200 Subject: [PATCH] Localize upstream /help changes --- locales/en/bot.json | 4 ++-- locales/resources.d.ts | 4 ++-- src/interactions/commands/info/help.ts | 28 ++------------------------ 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/locales/en/bot.json b/locales/en/bot.json index cd9f013..4634d72 100644 --- a/locales/en/bot.json +++ b/locales/en/bot.json @@ -56,9 +56,9 @@ "name": "help", "description": "Show the list of bot commands." }, - "addBotCallout": "{{icon}} **Enjoying {{botName}}?**\nAdd me to another server:\n**[Click me!]({{invite}})**", + "addBotButton": "Add bot", "listTitle": "{{icon}} **List of commands**", - "supportServerCallout": "{{icon}} **Support server**\nJoin the support server for help or to suggest improvements:\n{{invite}}" + "supportServerButton": "Support server" }, "history": { "metadata": { diff --git a/locales/resources.d.ts b/locales/resources.d.ts index d25b7b7..9f0564f 100644 --- a/locales/resources.d.ts +++ b/locales/resources.d.ts @@ -57,9 +57,9 @@ interface Resources { "name": "help", "description": "Show the list of bot commands." }, - "addBotCallout": "{{icon}} **Enjoying {{botName}}?**\nAdd me to another server:\n**[Click me!]({{invite}})**", + "addBotButton": "Add bot", "listTitle": "{{icon}} **List of commands**", - "supportServerCallout": "{{icon}} **Support server**\nJoin the support server for help or to suggest improvements:\n{{invite}}" + "supportServerButton": "Support server" }, "history": { "metadata": { diff --git a/src/interactions/commands/info/help.ts b/src/interactions/commands/info/help.ts index 35edf60..89170ff 100644 --- a/src/interactions/commands/info/help.ts +++ b/src/interactions/commands/info/help.ts @@ -15,7 +15,6 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; import { ExtendedClient } from '../../../types/clientTypes'; -import { TFunction } from 'i18next'; class HelpCommand extends BaseSlashCommandInteraction { constructor() { @@ -37,7 +36,7 @@ class HelpCommand extends BaseSlashCommandInteraction { .setURL(this.botOptions.serverInviteUrl) .setStyle(ButtonStyle.Link) .setEmoji(this.embedOptions.icons.support) - .setLabel('Support server') + .setLabel(translator('commands.help.supportServerButton')) .toJSON(); components.push(supportServerButton); } @@ -47,7 +46,7 @@ class HelpCommand extends BaseSlashCommandInteraction { .setURL(this.botOptions.botInviteUrl) .setStyle(ButtonStyle.Link) .setEmoji(this.embedOptions.icons.bot) - .setLabel('Add bot') + .setLabel(translator('commands.help.addBotButton')) .toJSON(); components.push(addBotButton); } @@ -110,29 +109,6 @@ class HelpCommand extends BaseSlashCommandInteraction { } return ''; } - - private async getSupportServerString(translator: TFunction): Promise { - if (!this.botOptions.serverInviteUrl) { - return ''; - } - - return translator('commands.help.supportServerCallout', { - icon: this.embedOptions.icons.support, - invite: this.botOptions.serverInviteUrl - }); - } - - private async getAddBotString(translator: TFunction): Promise { - if (!this.botOptions.botInviteUrl) { - return ''; - } - - return translator('commands.help.addBotCallout', { - icon: this.embedOptions.icons.bot, - botName: this.botOptions.name, - invite: this.botOptions.botInviteUrl - }); - } } export default new HelpCommand();