Skip to content

Commit

Permalink
Update Client.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JustCat80 committed May 29, 2021
1 parent 396e040 commit ded180f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,39 @@ class Client extends EventEmitter {
return this.requestHandler.request("PATCH", Endpoints.GUILD_WIDGET(guildID), true, options);
}

/**
* Edit an interaction message
* @arg {String} appID The ID of the application
* @arg {String} interactToken The Token of the interaction
* @arg {String} mesID The id of the message you wish to edit
* @arg {String | Array | Object} content A string, array of strings, or object. If an object is passed:
* @arg {Object} [content.allowedMentions] A list of mentions to allow (overrides default)
* @arg {Boolean} [content.allowedMentions.everyone] Whether or not to allow @everyone/@here.
* @arg {Boolean | Array<String>} [content.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow.
* @arg {Boolean | Array<String>} [content.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow.
* @arg {String} content.content A content string
* @arg {Object} [content.embed] An embed object. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#embed-object) for object structure
* @arg {Number} [content.flags] A number representing the flags to apply to the message. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#message-object-message-flags) for flags reference
* @returns {Promise<Message>}
*/
editInteractionMessage(appID, interactToken, msgID, content) {
if(content !== undefined) {
if(typeof content !== "object" || content === null) {
content = {
content: "" + content
};
} else if(content.content !== undefined && typeof content.content !== "string") {
content.content = "" + content.content;
} else if(content.content === undefined && !content.embed && content.flags === undefined) {
return Promise.reject(new Error("No content, embed or flags"));
}
if(content.content !== undefined || content.embed || content.allowedMentions) {
content.allowed_mentions = this._formatAllowedMentions(content.allowedMentions);
}
}
return this.requestHandler.request("PATCH", Endpoints.GET_INTERACTION_RESPONSE(appID, interactToken, msgID), true, content).then((message) => new Message(message, this));
}

/**
* Edit a message
* @arg {String} channelID The ID of the channel
Expand Down

0 comments on commit ded180f

Please sign in to comment.