From fe0d9ef75f6f310f08f054653d16da8e0152820f Mon Sep 17 00:00:00 2001 From: Daryl Ronningen Date: Tue, 29 Jun 2021 22:09:42 -0500 Subject: [PATCH] feat: added owo language cuz i can :) --- src/commands/general/help.ts | 9 +++++---- src/index.ts | 6 +++++- translations/owo/commands.json | 35 ++++++++++++++++++++++++++++++++++ translations/owo/common.json | 1 + 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 translations/owo/commands.json create mode 100644 translations/owo/common.json diff --git a/src/commands/general/help.ts b/src/commands/general/help.ts index 73ccb69..3b2d711 100644 --- a/src/commands/general/help.ts +++ b/src/commands/general/help.ts @@ -16,10 +16,11 @@ */ import Command from '@structures/command'; import config from 'config'; -import { MessageButton } from 'discord.js'; -import { Client, Message, MessageEmbed } from 'discord.js'; +import { Client, Message, MessageButton, MessageEmbed } from 'discord.js'; import i18next from 'i18next'; +// TODO: Redo this mf + export default class extends Command { public constructor(client: Client, file: string) { super(client, file, { @@ -58,7 +59,7 @@ export default class extends Command { val.embed.setAuthor(i18next.t('commands:help.embedName')); val.embed.setTitle(val.name.toUpperCase()); val.embed.setColor(message.member?.roles.highest.color ?? 0xFFFFFF); - val.embed.setFooter(`Page ${index+1}/${commandGroups.length}`); + val.embed.setFooter(`Page ${index + 1}/${commandGroups.length}`); val.embed.setTimestamp(); val.commands.forEach((command) => { @@ -91,7 +92,7 @@ export default class extends Command { if(interaction.customID === 'nextCategoryBtn') { currentPage++; - if(currentPage+1 === commandGroups.length) { + if(currentPage + 1 === commandGroups.length) { nextCategoryBtn.setDisabled(true); } diff --git a/src/index.ts b/src/index.ts index bf6d0ae..d4f18b2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,8 @@ client.on('message', async (msg) => { msg.channel.startTyping(); + await i18next.changeLanguage('owo'); + if(findCommand.options.ownerOnly && msg.author.id !== config.get('owner')) { await msg.reply(i18next.t('commands:errors.ownerOnly')); return; @@ -112,6 +114,8 @@ client.on('message', async (msg) => { await msg.reply(i18next.t('commands:errors.runError', { error: e.message })); msg.channel.stopTyping(); } + + await i18next.changeLanguage('en-US'); }); client.on('ready', async () => { @@ -123,7 +127,7 @@ client.on('ready', async () => { defaultNS: 'common', fallbackNS: 'common', fallbackLng: 'en-US', - supportedLngs: ['en-US'], + supportedLngs: ['en-US', 'owo'], backend: { backends: [FSBackend], backendOptions: [ diff --git a/translations/owo/commands.json b/translations/owo/commands.json new file mode 100644 index 0000000..e2f1727 --- /dev/null +++ b/translations/owo/commands.json @@ -0,0 +1,35 @@ +{ + "vm": { + "shortDescription": "Wuns code in a safe sandbox fow testing", + "extendedDescription": "Wuns code in a secuwe and safe sandbox fow pwototyping & testing code whiwe pweventing access to the system", + "languageArg": "The wanguage to use (JavaScript/TypeScript)", + "codeArg": "The code to wun in the VM", + "computing": "Computing { $language } code... Pwease wait owo", + "error": "An ewwow has occuwwed whiwe executing { $language } code!\n```\n{ $error }\n```", + "unknown": "Unknyown wanguage given owo" + }, + "help": { + "shortDescription": "Shows hewp menyu", + "extendedDescription": "Shows an advanced hewp menyu fow commands to show usage", + "commandArg": "The command to see", + "unknownCommand": "Unknyown command given (・`ω´・)", + "embedName": "Hewp Menyu (・`ω´・)", + "helpScreenBtnHelp": "Pwess the \"Fowwawd\" ow \"Back\" Button to muv categowies owo ", + "nextCategoryBtn": "Nyext Categowy", + "previousCategoryBtn": "Pwevious Categowy", + "helpTimedOut": "Timed Out", + "commandDescription": "Nyame: { $name }\nCategowy: { $category }\nDescwiption: { $description }\nUsage: { $usage }" + }, + "errors": { + "ownerOnly": "Onwy the bot ownyew can wun this command ^w^", + "dmsOnly": "You can onwy wun this command in DMs owo", + "serverOnly": "You can onwy wun this command in a sewvew owo", + "runError": "I'm sowwy but an ewwow has occuwwed whiwe wunnying this command ;;w;; Pwease fiwe an issue to https://code.relms.dev/Relms/ArgonBot!\n```{ $error }```" + }, + "generic": { + "noShortDescription": "Nyo showt descwiption given >w<", + "noExtendedDescription": "Nyo extended descwiption given ^w^", + "noArgsDescription": "Nyo descwiption fow { $arg } has been given UwU", + "noUsage": "Nyo usage given ;;w;;" + } +} diff --git a/translations/owo/common.json b/translations/owo/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/translations/owo/common.json @@ -0,0 +1 @@ +{}