feat: Super Reaction
test: ❌
This commit is contained in:
@@ -573,6 +573,14 @@ class ClientUser extends User {
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Super Reactions
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
fetchBurstCredit() {
|
||||
return this.client.api.users['@me']['burst-credits'].get().then(d => d.amount);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientUser;
|
||||
|
@@ -792,6 +792,7 @@ class Message extends Base {
|
||||
/**
|
||||
* Adds a reaction to the message.
|
||||
* @param {EmojiIdentifierResolvable} emoji The emoji to react with
|
||||
* @param {boolean} [burst=false] Super Reactions (Discord Nitro only)
|
||||
* @returns {Promise<MessageReaction>}
|
||||
* @example
|
||||
* // React to a message with a unicode emoji
|
||||
@@ -804,9 +805,9 @@ class Message extends Base {
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async react(emoji) {
|
||||
async react(emoji, burst = false) {
|
||||
if (!this.channel) throw new Error('CHANNEL_NOT_CACHED');
|
||||
await this.channel.messages.react(this.id, emoji);
|
||||
await this.channel.messages.react(this.id, emoji, burst);
|
||||
|
||||
return this.client.actions.MessageReactionAdd.handle(
|
||||
{
|
||||
@@ -814,6 +815,7 @@ class Message extends Base {
|
||||
channel: this.channel,
|
||||
message: this,
|
||||
emoji: Util.resolvePartialEmoji(emoji),
|
||||
me_burst: burst,
|
||||
},
|
||||
true,
|
||||
).reaction;
|
||||
|
@@ -30,6 +30,12 @@ class MessageReaction {
|
||||
*/
|
||||
this.me = data.me;
|
||||
|
||||
/**
|
||||
* Whether the client has given this super reaction
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.meBurst = Boolean(data.me_burst);
|
||||
|
||||
/**
|
||||
* A manager of the users that have given this reaction
|
||||
* @type {ReactionUserManager}
|
||||
@@ -49,6 +55,22 @@ class MessageReaction {
|
||||
*/
|
||||
this.count ??= data.count;
|
||||
}
|
||||
|
||||
if ('burst_count' in data) {
|
||||
/**
|
||||
* The number of people that have given the same super reaction
|
||||
* @type {?number}
|
||||
*/
|
||||
this.burstCount ??= data.burst_count;
|
||||
}
|
||||
|
||||
if ('burst_colors' in data) {
|
||||
/**
|
||||
* Burst colors of the reaction
|
||||
* @type {?string[]}
|
||||
*/
|
||||
this.burstColors ??= data.burst_colors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user