Mylloon
dad41d3932
Some checks failed
Publish latest version / build (push) Has been cancelled
- no longer fallback to known-bad values - fix build (related to typescript update finding new quirks) Reviewed-on: #166 Co-authored-by: Mylloon <kennel.anri@tutanota.com> Co-committed-by: Mylloon <kennel.anri@tutanota.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { SlashCommandBuilder } from "@discordjs/builders";
|
|
import { ChatInputCommandInteraction, Client, Message } from "discord.js";
|
|
import { getLocale, getLocalizations } from "../../utils/locales";
|
|
import { getFilename } from "../../utils/misc";
|
|
|
|
export default {
|
|
scope: () => [],
|
|
|
|
data: (client: Client) => {
|
|
const filename = getFilename(__filename);
|
|
return new SlashCommandBuilder()
|
|
.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`));
|
|
},
|
|
|
|
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
|
const loc = getLocale(client, interaction.locale);
|
|
|
|
const sent = (await interaction.reply({
|
|
content: "Pinging...",
|
|
fetchReply: true,
|
|
})) as Message;
|
|
|
|
interaction.editReply(
|
|
`${loc?.get("c_ping1")}: \
|
|
${sent.createdTimestamp - interaction.createdTimestamp}ms
|
|
${loc?.get("c_ping2")}: ${client.ws.ping}ms.`,
|
|
);
|
|
},
|
|
};
|