Fix replies without text that include attachments
parent
692697d44f
commit
158db3c070
|
@ -1,10 +1,16 @@
|
||||||
const attachments = require("../data/attachments");
|
const attachments = require("../data/attachments");
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
module.exports = (bot, knex, config, commands) => {
|
module.exports = (bot, knex, config, commands) => {
|
||||||
// Mods can reply to modmail threads using !r or !reply
|
// 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
|
// These messages get relayed back to the DM thread between the bot and the user
|
||||||
commands.addInboxThreadCommand('reply', '<text$>', async (msg, args, thread) => {
|
commands.addInboxThreadCommand('reply', '[text$]', async (msg, args, thread) => {
|
||||||
const replied = await thread.replyToUser(msg.member, args.text, msg.attachments, false);
|
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();
|
if (replied) msg.delete();
|
||||||
}, {
|
}, {
|
||||||
aliases: ['r']
|
aliases: ['r']
|
||||||
|
@ -12,8 +18,13 @@ module.exports = (bot, knex, config, commands) => {
|
||||||
|
|
||||||
|
|
||||||
// Anonymous replies only show the role, not the username
|
// Anonymous replies only show the role, not the username
|
||||||
commands.addInboxThreadCommand('anonreply', '<text$>', async (msg, args, thread) => {
|
commands.addInboxThreadCommand('anonreply', '[text$]', async (msg, args, thread) => {
|
||||||
const replied = await thread.replyToUser(msg.member, args.text, msg.attachments, true);
|
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();
|
if (replied) msg.delete();
|
||||||
}, {
|
}, {
|
||||||
aliases: ['ar']
|
aliases: ['ar']
|
||||||
|
|
Loading…
Reference in New Issue