mirror of
https://github.com/danbulant/discord.js
synced 2026-05-29 20:30:38 +00:00
* Start Store cleanup * wip store cleanup * fix iterables initiating datastores * handle the possibility of a datastore with no holds and no its own 'create' method * more cleanup (instances that need more than just client/data) * missed RoleStore extras * not sure how eslint didn't catch that tab... * avoid re-getting the channel we already have... * cleanup resolvers and refactor them into DataStores * ^ * and remove * fix some bugs * fix lint * fix documentation maybe? * formatting * fix presences * really fix presences this time * bad fix was bad... let;s see how bad this one is.. * forgot to save a file * make presence resolving take userresolveables too * fix tabs in jsdocs * fix bad fix from last night that caused issues, with better fix... * oops
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
const DataStore = require('./DataStore');
|
|
const MessageReaction = require('../structures/MessageReaction');
|
|
|
|
/**
|
|
* Stores reactions.
|
|
* @private
|
|
* @extends {DataStore}
|
|
*/
|
|
class ReactionStore extends DataStore {
|
|
constructor(message, iterable) {
|
|
super(message.client, iterable, MessageReaction);
|
|
this.message = message;
|
|
}
|
|
|
|
create(data, cache) {
|
|
data.emoji.id = data.emoji.id || decodeURIComponent(data.emoji.name);
|
|
return super.create(data, cache, { id: data.emoji.id, extras: [this.message] });
|
|
}
|
|
|
|
/**
|
|
* Data that can be resolved to a MessageReaction object. This can be:
|
|
* * A MessageReaction
|
|
* * A Snowflake
|
|
* @typedef {MessageReaction|Snowflake} MessageReactionResolvable
|
|
*/
|
|
|
|
/**
|
|
* Resolves a MessageReactionResolvable to a MessageReaction object.
|
|
* @method resolve
|
|
* @memberof ReactionStore
|
|
* @param {MessageReactionResolvable} reaction The MessageReaction to resolve
|
|
* @returns {?MessageReaction}
|
|
*/
|
|
|
|
/**
|
|
* Resolves a MessageReactionResolvable to a MessageReaction ID string.
|
|
* @method resolveID
|
|
* @memberof ReactionStore
|
|
* @param {MessageReactionResolvable} role The role resolvable to resolve
|
|
* @returns {?string}
|
|
*/
|
|
}
|
|
|
|
module.exports = ReactionStore;
|