mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
Custom Ping Command
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ client.registry
|
|||||||
['roleplay', 'Roleplay']
|
['roleplay', 'Roleplay']
|
||||||
])
|
])
|
||||||
.registerDefaultGroups()
|
.registerDefaultGroups()
|
||||||
.registerDefaultCommands({ help: false })
|
.registerDefaultCommands({ help: false, ping: false })
|
||||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
|
||||||
|
module.exports = class PingCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'ping',
|
||||||
|
aliases: ['pong', 'ping-pong'],
|
||||||
|
group: 'util',
|
||||||
|
memberName: 'ping',
|
||||||
|
description: 'Checks the bot\'s ping to the Discord server.',
|
||||||
|
guarded: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg) {
|
||||||
|
const message = await msg.say('Pinging...');
|
||||||
|
return message.edit(stripIndents`
|
||||||
|
:ping_pong: Pong!
|
||||||
|
**Message Ping:** ${Math.round(msg.createdTimestamp - message.createdTimestamp)}ms
|
||||||
|
**Heartbeat Ping:** ${Math.round(this.client.ping)}ms
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "21.4.2",
|
"version": "21.4.3",
|
||||||
"description": "A Discord Bot",
|
"description": "A Discord Bot",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user