1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
const attachments = require("../data/attachments");
const utils = require('../utils');
module.exports = ({ bot, knex, config, commands }) => {
// Mods can reply to modmail threads using !r or !reply
// These messages get relayed back to the DM thread between the bot and the user
commands.addInboxThreadCommand('reply', '[text$]', async (msg, args, thread) => {
if (! args.text && msg.attachments.length === 0) {
utils.postError(msg.channel, 'Text or attachment required');
return;
}
const replied = await thread.replyToUser(msg.member, args.text || '', msg.attachments, false);
if (replied) msg.delete();
}, {
aliases: ['r']
});
// Anonymous replies only show the role, not the username
commands.addInboxThreadCommand('anonreply', '[text$]', async (msg, args, thread) => {
if (! args.text && msg.attachments.length === 0) {
utils.postError(msg.channel, 'Text or attachment required');
return;
}
const replied = await thread.replyToUser(msg.member, args.text || '', msg.attachments, true);
if (replied) msg.delete();
}, {
aliases: ['ar']
});
};
|