aboutsummaryrefslogtreecommitdiff
path: root/src/modules/alert.js
blob: a8442308752759ecbaa0f81888114f9a3a95a6db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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`);
    }
  });
};