-
-
Save net-tech/1aac0c3321e1ffd1ad31c22de6805a4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Stopwatch } = require("stopwatch") | |
const prettyMilliseconds = require('pretty-ms'); | |
const { CommandType } = require("wokcommands"); | |
module.exports = { | |
aliases: ['status'], | |
name: 'ping', | |
category: 'Utility', | |
description: 'Get the websocket latency', | |
cooldown: '3s', | |
cooldowns: { | |
perUser: 3, | |
}, | |
guildOnly: true, | |
type: CommandType.BOTH, | |
ownerOnly: false, | |
testOnly: false, | |
callback: async ({ client, message, interaction }) => { | |
console.log("1") | |
if (interaction) { | |
await interaction.reply("📡 Ping 1") | |
const stopwatch = new Stopwatch().start() | |
await interaction.editReply("🛰️ Ping 2") | |
stopwatch.stop() | |
interaction.editReply(`⏱️ Message Latency: ${stopwatch.toString()}\n🛰️ Websocket Latency: ${client.ws.ping}\n🔌 Uptime: ${await prettyMilliseconds(client.uptime)}`) | |
} else { | |
let msg = await message.channel.send("📡 Ping 1") | |
const stopwatch = new Stopwatch().start() | |
msg = await msg.edit("🛰️ Ping 2") | |
stopwatch.stop() | |
msg.edit(`⏱️ Message Latency: ${stopwatch.toString()}\n🛰️ Websocket Latency: ${client.ws.ping}\n🔌 Uptime: ${await prettyMilliseconds(client.uptime)}`) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment