forked from Galactic/modmail
bugfix for empty messages
This commit is contained in:
parent
88fdf4e7b9
commit
c325bf5ab4
@ -12,7 +12,6 @@ class Modmail extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async execute (message, { args }) {
|
async execute (message, { args }) {
|
||||||
|
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let [ first, second ] = args.map((a) => a);
|
let [ first, second ] = args.map((a) => a);
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
@ -37,15 +36,14 @@ class Modmail extends Command {
|
|||||||
error: true,
|
error: true,
|
||||||
msg: 'Cannot send modmail to a bot.'
|
msg: 'Cannot send modmail to a bot.'
|
||||||
};
|
};
|
||||||
content = content.replace(first, '');
|
content = content.replace(first, '').trim();
|
||||||
|
|
||||||
if (!content.length) return {
|
if (!content.length) return {
|
||||||
error: true,
|
error: true,
|
||||||
msg: `Cannot send empty message`
|
msg: `Cannot send empty message`
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.client.modmail.sendModmail({ message, content: content.trim(), anon, target: user });
|
return this.client.modmail.sendModmail({ message, content, anon, target: user });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user