diff options
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/debug.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/debug.js b/src/cmd/debug.js index ecb475c..382b0b3 100644 --- a/src/cmd/debug.js +++ b/src/cmd/debug.js @@ -1,5 +1,19 @@ +const mcs = require('node-mcstatus'); + module.exports.loadModule = function loadModule(bot) { bot.handler.endpoint('^ping$', [], (match, message) => { bot.createMessage(message.channel.id, 'Pong').catch(Logger.error); }); + + bot.handler.endpoint('^server$', [], async (match, message) => { + let results = await mcs.statusJava('minecraft1240.omgserv.com', 10004); + + let msg = `${results.players.online}/${results.players.max} connected:\n`; + + results.players.list.forEach(p => { + msg += `- ${p.name_clean}\n`; + }); + + bot.createMessage(message.channel.id, msg); + }); }; |
