From 2776048d336f96349a9b605125382b45b0852f28 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 21 Jul 2022 17:44:55 +0200 Subject: [PATCH] Add name base on filename and desc based on default language --- src/commands/misc/ping.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/commands/misc/ping.ts b/src/commands/misc/ping.ts index 10881aa..4d2e8ff 100644 --- a/src/commands/misc/ping.ts +++ b/src/commands/misc/ping.ts @@ -3,9 +3,14 @@ import { Client, CommandInteraction, Message } from 'discord.js'; import { getLocale } from '../../utils/locales'; export default { - data: (client: Client) => new SlashCommandBuilder() - .setNameLocalizations(getLocale(client, 'c_ping_name')) - .setDescriptionLocalizations(getLocale(client, 'c_ping_desc')), + data: (client: Client) => { + const path = __filename.split('/'); + return new SlashCommandBuilder() + .setName(path[path.length - 1].split('.')[0]) + .setDescription(client.locales.get(client.config.default_lang)?.get('c_ping_desc') ?? '?') + .setNameLocalizations(getLocale(client, 'c_ping_name')) + .setDescriptionLocalizations(getLocale(client, 'c_ping_desc')); + }, interaction: async (interaction: CommandInteraction, client: Client) => { const loc = client.locales.get(interaction.locale) ?? client.locales.get(client.config.default_lang);