mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-07-07 11:31:01 +02:00
feat(arabot): add ping message command
This commit is contained in:
parent
41255f66c2
commit
a42819ea86
@ -19,6 +19,7 @@
|
||||
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
import { Command } from '@sapphire/framework';
|
||||
import type { Message } from 'discord.js';
|
||||
|
||||
export class PingCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
@ -48,4 +49,13 @@ export class PingCommand extends Command {
|
||||
|
||||
return interaction.editReply('Failed to retrieve ping :(');
|
||||
}
|
||||
|
||||
public async messageRun(message: Message) {
|
||||
const msg = await message.channel.send('Ping?');
|
||||
|
||||
const diff = msg.createdTimestamp - message.createdTimestamp;
|
||||
const ping = Math.round(this.container.client.ws.ping);
|
||||
|
||||
return msg.edit(`Pong 🏓! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user