aboutsummaryrefslogtreecommitdiff
path: root/commands/ping.ts
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-07-13 23:34:21 +0200
committerMinteck <contact@minteck.org>2022-07-13 23:34:21 +0200
commit7b5df4ca0a5bd6fcf033ef40563599593b156910 (patch)
tree56cb89f3900adde9da67e7558793a20fb40d7197 /commands/ping.ts
downloadcooler-pony-7b5df4ca0a5bd6fcf033ef40563599593b156910.tar.gz
cooler-pony-7b5df4ca0a5bd6fcf033ef40563599593b156910.tar.bz2
cooler-pony-7b5df4ca0a5bd6fcf033ef40563599593b156910.zip
Initial commit
Diffstat (limited to 'commands/ping.ts')
-rw-r--r--commands/ping.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/commands/ping.ts b/commands/ping.ts
new file mode 100644
index 0000000..5b79231
--- /dev/null
+++ b/commands/ping.ts
@@ -0,0 +1,33 @@
+import {CommandBase} from "../core/CommandBase";
+import {MessageEmbed} from "discord.js";
+import {SlashCommandBuilder} from "@discordjs/builders";
+import {CommandAction} from "../core/CommandAction";
+
+export class PingCommand extends CommandBase {
+ constructor() {
+ super();
+ this.slashCommandData = new SlashCommandBuilder()
+ .setName("ping")
+ .setDescription("Shows the latency between the bot and Discord")
+ }
+
+ public handle(action: CommandAction) {
+ let interaction = action.getInteraction();
+ let VoiceBase = global.VoiceBase;
+ let processing = new Date().getTime() - global.processingStart;
+ let interactionTime = new Date().getTime() - interaction.createdAt.getTime();
+ let apiTime = global.client.ws.ping;
+
+ interaction.reply({
+ embeds: [
+ new MessageEmbed()
+ .setTitle(":rocket: Pong!")
+ .addFields(
+ {name: "Processing", value: processing.toFixed(2) + "ms", inline: true},
+ {name: "Interaction", value: interactionTime.toFixed(2) + "ms", inline: true},
+ {name: "API", value: apiTime.toFixed(2) + "ms", inline: true}
+ )
+ ]
+ });
+ }
+} \ No newline at end of file