From 319f6571bcc456984f474037266f495d723e71f5 Mon Sep 17 00:00:00 2001 From: Dragory Date: Sat, 21 Apr 2018 15:41:03 +0300 Subject: [PATCH] Add !id The !id command returns the user ID of the current thread. Useful for getting the user ID on mobile. --- src/main.js | 2 ++ src/modules/id.js | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/modules/id.js diff --git a/src/main.js b/src/main.js index 6b6cf51..67cde89 100644 --- a/src/main.js +++ b/src/main.js @@ -19,6 +19,7 @@ const greeting = require('./modules/greeting'); const typingProxy = require('./modules/typingProxy'); const version = require('./modules/version'); const newthread = require('./modules/newthread'); +const idModule = require('./modules/id'); const attachments = require("./data/attachments"); const {ACCIDENTAL_THREAD_MESSAGES} = require('./data/constants'); @@ -172,6 +173,7 @@ module.exports = { await typingProxy(bot); await version(bot); await newthread(bot); + await idModule(bot); // Connect to Discord console.log('Connecting to Discord...'); diff --git a/src/modules/id.js b/src/modules/id.js new file mode 100644 index 0000000..7e8c6b1 --- /dev/null +++ b/src/modules/id.js @@ -0,0 +1,10 @@ +const threadUtils = require("../threadUtils"); + +module.exports = bot => { + const addInboxServerCommand = (...args) => threadUtils.addInboxServerCommand(bot, ...args); + + addInboxServerCommand('id', async (msg, args, thread) => { + if (! thread) return; + thread.postSystemMessage(thread.user_id); + }); +};