summaryrefslogtreecommitdiff
path: root/src/cmd/debug.js
diff options
context:
space:
mode:
authorAlejandro W. Sior <aho@sior.be>2024-01-24 23:58:45 +0100
committerAlejandro W. Sior <aho@sior.be>2024-01-24 23:58:45 +0100
commit4eaca0632036c77fc0df7ebe84e530c62a349091 (patch)
treee071c484377f0fa6d38b6650668407509bbba74d /src/cmd/debug.js
parenta6fa7d3ff52fe01dcf2e448e3e3c452cfd9044ac (diff)
add server command
Diffstat (limited to 'src/cmd/debug.js')
-rw-r--r--src/cmd/debug.js14
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);
+ });
};