UNPKG

@ayanaware/bentocord

Version:

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.

32 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PingCommand = void 0; const CommandManager_1 = require("../CommandManager"); class PingCommand { constructor() { this.name = '@ayanaware/bentocord:PingCommand'; this.parent = CommandManager_1.CommandManager; this.replaceable = true; this.definition = { name: ['ping', 'pong', { key: 'BENTOCORD_COMMAND_PING' }, { key: 'BENTOCORD_COMMAND_PONG' }], description: { key: 'BENTOCORD_COMMAND_PING_DESCRIPTION', backup: 'Check if the bot is online' }, }; } async execute(ctx) { const start = process.hrtime(); await ctx.createTranslatedResponse('BENTOCORD_PING', {}, 'Pong!'); const end = process.hrtime(start); const s = end[0]; const ms = end[1] / 1000000; // if in guild, include shard latency. message should really include a shard if (ctx.guild) { const ws = ctx.guild.shard.latency; if (ws !== Infinity) { return ctx.editTranslatedResponse('BENTOCORD_PING_COUNT_WS', { s, ms, ws }, 'Pong! API: `{s}s {ms}ms`, Gateway: `{ws}ms`'); } } return ctx.editTranslatedResponse('BENTOCORD_PING_COUNT', { s, ms }, 'Pong! `{s}s {ms}ms`'); } } exports.PingCommand = PingCommand; //# sourceMappingURL=Ping.js.map