Files
logori/src/cmd/debug.js
2018-07-02 17:44:37 +02:00

18 lines
651 B
JavaScript

const commandH = require('../commandHandler');
const bot = require('../botClient').bot;
exports.loadModule = function loadModule () {
commandH.endpoint('^ping$', (match, message) => {
bot.createMessage(message.channel.id, 'Pong');
});
commandH.endpoint('^ping (.*)$', (match, message) => {
bot.createMessage(message.channel.id, 'Pong : ' + match[1]);
let time = new Date();
bot.once('messageCreate', (msg) => {
let ms = new Date().getTime() - time.getTime();
if (msg.channel !== message.channel) return;
if (msg.author !== bot.user) return;
bot.createMessage(msg.channel.id, ms + ' ms');
});
});
};