This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
anitrox/commands/ping.js

32 lines
871 B
JavaScript

module.exports = {
name: require('path').parse(__filename).name,
description: 'Gets bot ping',
options: [],
async parseMessage (client, config, message, args) {
await message.channel.send(await this.handle(client, config, message.author));
},
async parseInteraction (client, config, interaction) {
await interaction.reply(await this.handle(client, config, interaction.user));
},
async handle (client, config, user) {
const index = Math.floor(Math.random() * config.locations.length);
const location = config.locations[index];
return {
embeds: [{
title: ':ping_pong: Ping',
description: `**Pong!** We pinged **${location}** and got ${client.ws.ping} ms.`,
color: 9442302,
footer: {
icon_url: user.displayAvatarURL(),
text: config.footerTxt
}
}]
};
}
};