feat: locales #27

Merged
Anri merged 26 commits from lang into main 2022-07-22 11:46:48 +02:00
Showing only changes of commit dcf325c7fc - Show all commits

View file

@ -1,15 +1,16 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from '@discordjs/builders';
import { Client, CommandInteraction, Message } from 'discord.js'; import { Client, CommandInteraction, Message } from 'discord.js';
import { getLocale } from '../../utils/locales'; import { getLocale } from '../../utils/locales';
import { getFilename } from '../../utils/misc';
export default { export default {
data: (client: Client) => { data: (client: Client) => {
const path = __filename.split('/'); const filename = getFilename(__filename);
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(path[path.length - 1].split('.')[0]) .setName(filename)
.setDescription(client.locales.get(client.config.default_lang)?.get('c_ping_desc') ?? '?') .setDescription(client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? '?')
.setNameLocalizations(getLocale(client, 'c_ping_name')) .setNameLocalizations(getLocale(client, `c_${filename}_name`))
.setDescriptionLocalizations(getLocale(client, 'c_ping_desc')); .setDescriptionLocalizations(getLocale(client, `c_${filename}_desc`));
}, },
interaction: async (interaction: CommandInteraction, client: Client) => { interaction: async (interaction: CommandInteraction, client: Client) => {