Skip to content

Commit

Permalink
Merge branch 'dev' into v9
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 committed Sep 3, 2021
2 parents 69d5acc + daedb2b commit b861556
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ declare namespace Eris {
}
interface PartialChannel {
bitrate?: number;
id?: number;
id: string;
name?: string;
nsfw?: boolean;
parent_id?: number;
Expand Down Expand Up @@ -889,6 +889,7 @@ declare namespace Eris {
}
interface AdvancedMessageContent {
allowedMentions?: AllowedMentions;
components?: ActionRow[];
content?: string;
/** @deprecated */
embed?: EmbedOptions;
Expand All @@ -897,6 +898,7 @@ declare namespace Eris {
messageReference?: MessageReferenceReply;
/** @deprecated */
messageReferenceID?: string;
stickerIDs?: string[];
tts?: boolean;
}
interface AdvancedMessageContentEdit extends AdvancedMessageContent {
Expand Down Expand Up @@ -1059,7 +1061,7 @@ declare namespace Eris {
interface PartialRole {
color?: number;
hoist?: boolean;
id?: number;
id: string;
mentionable?: boolean;
name?: string;
permissions?: number;
Expand Down
14 changes: 2 additions & 12 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>} [content.stickerIDs] An array of IDs corresponding to stickers to send
* @arg {Boolean} [content.tts] Set the message TTS flag
* @arg {Object | Array<Object>} [file] A file object (or an Array of them)
* @arg {Buffer} file.file A buffer containing file data
Expand All @@ -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) {
Expand All @@ -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));
}
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -1634,9 +1630,6 @@ class Client extends EventEmitter {
* @returns {Promise<Message>}
*/
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);
}
Expand Down Expand Up @@ -1727,9 +1720,6 @@ class Client extends EventEmitter {
* @returns {Promise<Message?>}
*/
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";
Expand Down
1 change: 1 addition & 0 deletions lib/structures/PrivateChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>} [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
Expand Down
1 change: 1 addition & 0 deletions lib/structures/TextChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>} [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
Expand Down

0 comments on commit b861556

Please sign in to comment.