Files
twitter/src/commands/util/ping.js
T
2026-03-22 02:15:16 -05:00

59 lines
1.6 KiB
JavaScript

'use strict';
const { time } = require("discord.js");
module.exports = {
name: 'ping',
description: `test the bot's latency to discord's servers and api`,
aliases: ['pong'],
usage: 'ping',
async execute(client, message) {
const sent = await message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
title: '',
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<a:loading_icon:1366587619890302998> pinging...',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
const latency = sent.createdTimestamp - message.createdTimestamp;
const apiLatency = Math.round(client.ws.ping);
const embed = {
color: 0x8aa2b3,
title: '',
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: 'fuck you!!!! 🖕',
fields: [
{ name: '# of cmds loaded', value: `**${client.commands.size}**`, inline: true },
{ name: 'bot latency', value: `**${latency}ms**`, inline: true },
{ name: 'api latency', value: `**${apiLatency}ms**`, inline: true },
],
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
thumbnail: {
url: client.user.displayAvatarURL(),
height: 1024,
width: 1024,
},
};
await sent.edit({ content: null, embeds: [embed] });
},
};