mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix reply splitting (#1750)
This commit is contained in:
@@ -15,6 +15,14 @@ module.exports = function sendMessage(channel, options) { // eslint-disable-line
|
|||||||
if (isNaN(nonce) || nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE');
|
if (isNaN(nonce) || nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the reply prefix
|
||||||
|
if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {
|
||||||
|
const id = channel.client.resolver.resolveUserID(reply);
|
||||||
|
const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;
|
||||||
|
if (split) split.prepend = `${mention}, ${split.prepend || ''}`;
|
||||||
|
content = `${mention}${typeof content !== 'undefined' ? `, ${content}` : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
content = Util.resolveString(content);
|
content = Util.resolveString(content);
|
||||||
if (split && typeof split !== 'object') split = {};
|
if (split && typeof split !== 'object') split = {};
|
||||||
@@ -36,14 +44,6 @@ module.exports = function sendMessage(channel, options) { // eslint-disable-line
|
|||||||
if (split) content = Util.splitMessage(content, split);
|
if (split) content = Util.splitMessage(content, split);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the reply prefix
|
|
||||||
if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {
|
|
||||||
const id = channel.client.resolver.resolveUserID(reply);
|
|
||||||
const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;
|
|
||||||
if (split) split.prepend = `${mention}, ${split.prepend || ''}`;
|
|
||||||
content = `${mention}${typeof content !== 'undefined' ? `, ${content}` : ''}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content instanceof Array) {
|
if (content instanceof Array) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const messages = [];
|
const messages = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user