From 2a53887abba882bf7b63aeda8dfa55fdb3ab8792 Mon Sep 17 00:00:00 2001 From: Sin-MacBook Date: Mon, 10 Aug 2020 23:44:20 +0200 Subject: clean this up when home --- src/modules/alert.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/modules/alert.js (limited to 'src/modules/alert.js') diff --git a/src/modules/alert.js b/src/modules/alert.js new file mode 100644 index 0000000..a844230 --- /dev/null +++ b/src/modules/alert.js @@ -0,0 +1,11 @@ +module.exports = ({ bot, knex, config, commands }) => { + commands.addInboxThreadCommand('alert', '[opt:string]', async (msg, args, thread) => { + if (args.opt && args.opt.startsWith('c')) { + await thread.setAlert(null); + await thread.postSystemMessage(`Cancelled new message alert`); + } else { + await thread.setAlert(msg.author.id); + await thread.postSystemMessage(`Pinging ${msg.author.username}#${msg.author.discriminator} when this thread gets a new reply`); + } + }); +}; -- cgit v1.2.3