From e4450c8417624b71d779cb4f41692538f9165e10 Mon Sep 17 00:00:00 2001 From: sowgro Date: Sat, 2 Sep 2023 19:12:47 -0400 Subject: first commit --- .../discord.js/src/managers/ReactionManager.js | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 node_modules/discord.js/src/managers/ReactionManager.js (limited to 'node_modules/discord.js/src/managers/ReactionManager.js') diff --git a/node_modules/discord.js/src/managers/ReactionManager.js b/node_modules/discord.js/src/managers/ReactionManager.js new file mode 100644 index 0000000..5535882 --- /dev/null +++ b/node_modules/discord.js/src/managers/ReactionManager.js @@ -0,0 +1,68 @@ +'use strict'; + +const { Routes } = require('discord-api-types/v10'); +const CachedManager = require('./CachedManager'); +const MessageReaction = require('../structures/MessageReaction'); + +/** + * Manages API methods for reactions and holds their cache. + * @extends {CachedManager} + */ +class ReactionManager extends CachedManager { + constructor(message, iterable) { + super(message.client, MessageReaction, iterable); + + /** + * The message that this manager belongs to + * @type {Message} + */ + this.message = message; + } + + _add(data, cache) { + return super._add(data, cache, { id: data.emoji.id ?? data.emoji.name, extras: [this.message] }); + } + + /** + * The reaction cache of this manager + * @type {Collection} + * @name ReactionManager#cache + */ + + /** + * Data that can be resolved to a MessageReaction object. This can be: + * * A MessageReaction + * * A Snowflake + * * The Unicode representation of an emoji + * @typedef {MessageReaction|Snowflake} MessageReactionResolvable + */ + + /** + * Resolves a {@link MessageReactionResolvable} to a {@link MessageReaction} object. + * @method resolve + * @memberof ReactionManager + * @instance + * @param {MessageReactionResolvable} reaction The MessageReaction to resolve + * @returns {?MessageReaction} + */ + + /** + * Resolves a {@link MessageReactionResolvable} to a {@link MessageReaction} id. + * @method resolveId + * @memberof ReactionManager + * @instance + * @param {MessageReactionResolvable} reaction The MessageReaction to resolve + * @returns {?Snowflake} + */ + + /** + * Removes all reactions from a message. + * @returns {Promise} + */ + async removeAll() { + await this.client.rest.delete(Routes.channelMessageAllReactions(this.message.channelId, this.message.id)); + return this.message; + } +} + +module.exports = ReactionManager; -- cgit v1.2.3