A function that can show bot ping connection (Voice Channel)

Is there a way to create a bot command that can show us the bot ping connection when the bot is in a voice channel? I don't ask or mention about Websocket or API latency.
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Catharsis
CatharsisOP3y ago
It doesn't work
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Catharsis
CatharsisOP3y ago
const { VoiceConnection } = require('@discordjs/voice')
const Discord = require('discord.js')

module.exports = {
name: 'latency',
run: async (client, message) => {
message.reply({
embeds: [
new Discord.EmbedBuilder()
.setColor('#ec9bbb')
.setTitle(`${client.emotes.info} | Latency`)
.addFields(
{ name: 'Websocket Latency', value: `${Math.round(client.ws.ping)} ms` },
{ name: 'API Latency', value: `${Date.now() - message.createdTimestamp} ms` },
{ name: 'Voice Ping Connection (Test)', value: `${VoiceConnection.client.ping.ws} ms` }
)
.setTimestamp()
]
})
}
}
const { VoiceConnection } = require('@discordjs/voice')
const Discord = require('discord.js')

module.exports = {
name: 'latency',
run: async (client, message) => {
message.reply({
embeds: [
new Discord.EmbedBuilder()
.setColor('#ec9bbb')
.setTitle(`${client.emotes.info} | Latency`)
.addFields(
{ name: 'Websocket Latency', value: `${Math.round(client.ws.ping)} ms` },
{ name: 'API Latency', value: `${Date.now() - message.createdTimestamp} ms` },
{ name: 'Voice Ping Connection (Test)', value: `${VoiceConnection.client.ping.ws} ms` }
)
.setTimestamp()
]
})
}
}
Any idea to fix it?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Catharsis
CatharsisOP3y ago
thank you everyone. i appreciate all the helps. i might try to learn more about it. @papiophidian @qjuh @shadow024
Want results from more Discord servers?
Add your server