discord.js/src/stores/ReactionStore.js
Yukine bf0a68dbac Mark DataStores as public to directly display them in the docs. (#2268)
* make EmojiStore not Private anymore.

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make GuildChannelStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make RoleStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make ReactionStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make all non private to stay consistent

* fix merge conflicts because of other PRs.
2018-01-20 08:00:44 +01:00

53 lines
1.4 KiB
JavaScript

const DataStore = require('./DataStore');
const MessageReaction = require('../structures/MessageReaction');
/**
* Stores reactions.
* @extends {DataStore}
*/
class ReactionStore extends DataStore {
constructor(message, iterable) {
super(message.client, iterable, MessageReaction);
this.message = message;
}
add(data, cache) {
return super.add(data, cache, { id: data.emoji.id || data.emoji.name, 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
* @instance
* @param {MessageReactionResolvable} reaction The MessageReaction to resolve
* @returns {?MessageReaction}
*/
/**
* Resolves a MessageReactionResolvable to a MessageReaction ID string.
* @method resolveID
* @memberof ReactionStore
* @instance
* @param {MessageReactionResolvable} role The role resolvable to resolve
* @returns {?Snowflake}
*/
/**
* Removes all reactions from a message.
* @returns {Promise<Message>}
*/
removeAll() {
return this.client.api.channels(this.message.channel.id).messages(this.message.id).reactions.delete()
.then(() => this.message);
}
}
module.exports = ReactionStore;