Add name base on filename and desc based on default language
This commit is contained in:
parent
4068e0da7f
commit
2776048d33
1 changed files with 8 additions and 3 deletions
|
@ -3,9 +3,14 @@ import { Client, CommandInteraction, Message } from 'discord.js';
|
||||||
import { getLocale } from '../../utils/locales';
|
import { getLocale } from '../../utils/locales';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: (client: Client) => new SlashCommandBuilder()
|
data: (client: Client) => {
|
||||||
.setNameLocalizations(getLocale(client, 'c_ping_name'))
|
const path = __filename.split('/');
|
||||||
.setDescriptionLocalizations(getLocale(client, 'c_ping_desc')),
|
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) => {
|
interaction: async (interaction: CommandInteraction, client: Client) => {
|
||||||
const loc = client.locales.get(interaction.locale) ?? client.locales.get(client.config.default_lang);
|
const loc = client.locales.get(interaction.locale) ?? client.locales.get(client.config.default_lang);
|
||||||
|
|
Loading…
Reference in a new issue