aboutsummaryrefslogtreecommitdiff
path: root/src/modules/alert.js
blob: 7ac923a922304b9620d0b3deda0debdbdd00dd82 (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.`);
    }
  });
};