2022-07-03 21:09:57 +02:00
|
|
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
2023-01-17 12:15:14 +01:00
|
|
|
import { ChatInputCommandInteraction, Client, Message } from 'discord.js';
|
2022-07-22 11:46:47 +02:00
|
|
|
import { getLocale, getLocalizations } from '../../utils/locales';
|
|
|
|
import { getFilename } from '../../utils/misc';
|
2022-07-03 21:09:57 +02:00
|
|
|
|
|
|
|
export default {
|
2022-07-22 11:46:47 +02:00
|
|
|
data: (client: Client) => {
|
|
|
|
const filename = getFilename(__filename);
|
|
|
|
return new SlashCommandBuilder()
|
2022-07-25 00:54:19 +02:00
|
|
|
.setName(
|
|
|
|
filename.toLowerCase())
|
|
|
|
.setDescription(client.locales.get(client.config.default_lang)
|
|
|
|
?.get(`c_${filename}_desc`) ?? '')
|
|
|
|
.setNameLocalizations(
|
|
|
|
getLocalizations(client, `c_${filename}_name`, true))
|
|
|
|
.setDescriptionLocalizations(
|
|
|
|
getLocalizations(client, `c_${filename}_desc`)
|
|
|
|
);
|
2022-07-22 11:46:47 +02:00
|
|
|
},
|
2022-07-03 21:09:57 +02:00
|
|
|
|
2023-01-17 12:15:14 +01:00
|
|
|
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
2022-07-22 11:46:47 +02:00
|
|
|
const loc = getLocale(client, interaction.locale);
|
|
|
|
|
2022-07-25 00:54:19 +02:00
|
|
|
const sent = await interaction.reply({
|
|
|
|
content: 'Pinging...',
|
|
|
|
fetchReply: true,
|
|
|
|
}) as Message;
|
2022-07-03 21:09:57 +02:00
|
|
|
|
|
|
|
interaction.editReply(
|
2022-07-22 11:46:47 +02:00
|
|
|
`${loc?.get('c_ping1')}: \
|
2022-07-03 21:09:57 +02:00
|
|
|
${sent.createdTimestamp - interaction.createdTimestamp}ms
|
2022-07-22 11:46:47 +02:00
|
|
|
${loc?.get('c_ping2')}: ${client.ws.ping}ms.`);
|
2022-07-03 21:09:57 +02:00
|
|
|
},
|
|
|
|
};
|