diff --git a/index.d.ts b/index.d.ts index e4825ba1d..ec17d2937 100644 --- a/index.d.ts +++ b/index.d.ts @@ -153,7 +153,7 @@ declare namespace Eris { } interface PartialChannel { bitrate?: number; - id?: number; + id: string; name?: string; nsfw?: boolean; parent_id?: number; @@ -889,6 +889,7 @@ declare namespace Eris { } interface AdvancedMessageContent { allowedMentions?: AllowedMentions; + components?: ActionRow[]; content?: string; /** @deprecated */ embed?: EmbedOptions; @@ -897,6 +898,7 @@ declare namespace Eris { messageReference?: MessageReferenceReply; /** @deprecated */ messageReferenceID?: string; + stickerIDs?: string[]; tts?: boolean; } interface AdvancedMessageContentEdit extends AdvancedMessageContent { @@ -1059,7 +1061,7 @@ declare namespace Eris { interface PartialRole { color?: number; hoist?: boolean; - id?: number; + id: string; mentionable?: boolean; name?: string; permissions?: number; diff --git a/lib/Client.js b/lib/Client.js index 2f5b7afb8..a19903c5c 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -609,6 +609,7 @@ class Client extends EventEmitter { * @arg {String} [content.messageReference.guildID] The guild ID of the referenced message * @arg {String} content.messageReference.messageID The message ID of the referenced message. This cannot reference a system message * @arg {String} [content.messageReferenceID] [DEPRECATED] The ID of the message should be replied to. Use `messageReference` instead + * @arg {Array} [content.stickerIDs] An array of IDs corresponding to stickers to send * @arg {Boolean} [content.tts] Set the message TTS flag * @arg {Object | Array} [file] A file object (or an Array of them) * @arg {Buffer} file.file A buffer containing file data @@ -623,13 +624,12 @@ class Client extends EventEmitter { }; } else if(content.content !== undefined && typeof content.content !== "string") { content.content = "" + content.content; - } else if(content.content === undefined && !content.embed && !content.embeds && !file) { - return Promise.reject(new Error("No content, file, or embeds")); } else if(content.embed && !content.embeds) { this.emit("warn", "[DEPRECATED] content.embed is deprecated. Use content.embeds instead"); content.embeds = [content.embed]; } content.allowed_mentions = this._formatAllowedMentions(content.allowedMentions); + content.sticker_ids = content.stickerIDs; if(content.messageReference) { content.message_reference = content.messageReference; if(content.messageReference.messageID !== undefined) { @@ -652,8 +652,6 @@ class Client extends EventEmitter { this.emit("warn", "[DEPRECATED] content.messageReferenceID is deprecated. Use content.messageReference instead"); content.message_reference = {message_id: content.messageReferenceID}; } - } else if(!file) { - return Promise.reject(new Error("No content, file, or embeds")); } return this.requestHandler.request("POST", Endpoints.CHANNEL_MESSAGES(channelID), true, content, file).then((message) => new Message(message, this)); } @@ -1354,8 +1352,6 @@ class Client extends EventEmitter { }; } else if(content.content !== undefined && typeof content.content !== "string") { content.content = "" + content.content; - } else if(content.content === undefined && !content.embed && !content.embeds && !content.components && content.flags === undefined) { - return Promise.reject(new Error("No content, embeds, components or flags")); } else if(content.embed && !content.embeds) { this.emit("warn", "[DEPRECATED] content.embed is deprecated. Use content.embeds instead"); content.embeds = [content.embed]; @@ -1634,9 +1630,6 @@ class Client extends EventEmitter { * @returns {Promise} */ editWebhookMessage(webhookID, token, messageID, options) { - if(!options.content && !options.embeds && !options.components && !options.file) { - return Promise.reject(new Error("No content, embed, components, or file")); - } if(options.allowedMentions) { options.allowed_mentions = this._formatAllowedMentions(options.allowedMentions); } @@ -1727,9 +1720,6 @@ class Client extends EventEmitter { * @returns {Promise} */ executeWebhook(webhookID, token, options) { - if(!options.content && !options.file && !options.embeds) { - return Promise.reject(new Error("No content, file, or embeds")); - } let qs = ""; if(options.wait) { qs += "&wait=true"; diff --git a/lib/structures/PrivateChannel.js b/lib/structures/PrivateChannel.js index a4eca21e7..8ae63e89d 100644 --- a/lib/structures/PrivateChannel.js +++ b/lib/structures/PrivateChannel.js @@ -71,6 +71,7 @@ class PrivateChannel extends Channel { * @arg {String} [content.messageReference.guildID] The guild ID of the referenced message * @arg {String} content.messageReference.messageID The message ID of the referenced message. This cannot reference a system message * @arg {String} [content.messageReferenceID] [DEPRECATED] The ID of the message should be replied to. Use `messageReference` instead + * @arg {Array} [content.stickerIDs] An array of IDs corresponding to the stickers to send * @arg {Boolean} [content.tts] Set the message TTS flag * @arg {Object} [file] A file object * @arg {Buffer} file.file A buffer containing file data diff --git a/lib/structures/TextChannel.js b/lib/structures/TextChannel.js index 259b5fa0d..d34a339ab 100644 --- a/lib/structures/TextChannel.js +++ b/lib/structures/TextChannel.js @@ -96,6 +96,7 @@ class TextChannel extends GuildChannel { * @arg {String} [content.messageReference.guildID] The guild ID of the referenced message * @arg {String} content.messageReference.messageID The message ID of the referenced message. This cannot reference a system message * @arg {String} [content.messageReferenceID] [DEPRECATED] The ID of the message should be replied to. Use `messageReference` instead + * @arg {Array} [content.stickerIDs] An array of IDs corresponding to the stickers to send * @arg {Boolean} [content.tts] Set the message TTS flag * @arg {Object} [file] A file object * @arg {Buffer} file.file A buffer containing file data