mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
Fix sendEmbed with array content
This commit is contained in:
parent
c37cd3fd91
commit
8b0e5aad38
1 changed files with 8 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ const path = require('path');
|
|||
const Message = require('../Message');
|
||||
const MessageCollector = require('../MessageCollector');
|
||||
const Collection = require('../../util/Collection');
|
||||
let GuildMember;
|
||||
|
||||
/**
|
||||
* Interface for classes that have text-channel-like features
|
||||
|
|
@ -23,7 +24,7 @@ class TextBasedChannel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Options that can be passed into send, sendMessage, sendFile, sendEmbed, sendCode, and Message#reply
|
||||
* Options provided when sending or editing a message
|
||||
* @typedef {Object} MessageOptions
|
||||
* @property {boolean} [tts=false] Whether or not the message should be spoken aloud
|
||||
* @property {string} [nonce=''] The nonce for the message
|
||||
|
|
@ -35,6 +36,7 @@ class TextBasedChannel {
|
|||
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
|
||||
* @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if
|
||||
* it exceeds the character limit. If an object is provided, these are the options for splitting the message.
|
||||
* @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -70,6 +72,7 @@ class TextBasedChannel {
|
|||
} else if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (options.file) {
|
||||
if (typeof options.file === 'string') options.file = { attachment: options.file };
|
||||
if (!options.file.name) {
|
||||
|
|
@ -81,6 +84,7 @@ class TextBasedChannel {
|
|||
options.file.name = 'file.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
return this.client.resolver.resolveBuffer(options.file.attachment).then(file =>
|
||||
this.client.rest.methods.sendMessage(this, content, options, {
|
||||
file,
|
||||
|
|
@ -88,12 +92,13 @@ class TextBasedChannel {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
return this.client.rest.methods.sendMessage(this, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to this channel
|
||||
* @param {StringResolvable} content Text for the message
|
||||
* @param {StringResolvable} [content] Text for the message
|
||||
* @param {MessageOptions} [options={}] Options for the message
|
||||
* @returns {Promise<Message|Message[]>}
|
||||
* @example
|
||||
|
|
@ -114,7 +119,7 @@ class TextBasedChannel {
|
|||
* @returns {Promise<Message>}
|
||||
*/
|
||||
sendEmbed(embed, content, options) {
|
||||
if (!options && typeof content === 'object') {
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
options = content;
|
||||
content = '';
|
||||
} else if (!options) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue