|
| 1 | +<a name="ReactionCollector"></a> |
| 2 | + |
| 3 | +## ReactionCollector ⇐ <code>Collector<Message></code> |
| 4 | +**Kind**: global class |
| 5 | +**Extends**: <code>Collector<Message></code> |
| 6 | +**Author**: Bsian, KhaaZ |
| 7 | +**Properties** |
| 8 | + |
| 9 | +| Name | Type | Description | |
| 10 | +| --- | --- | --- | |
| 11 | +| options | <code>Object</code> | | |
| 12 | +| options.timeout | <code>Number</code> | Number of ms before timing out | |
| 13 | +| options.count | <code>Number</code> | Number of reactions to collect | |
| 14 | +| options.ignoreBots | <code>Boolean</code> | Whether to ignore bots | |
| 15 | +| options.userID | <code>String</code> | Specify a userID to only collect message from this user | |
| 16 | + |
| 17 | + |
| 18 | +* [ReactionCollector](#ReactionCollector) ⇐ <code>Collector<Message></code> |
| 19 | + * [new ReactionCollector()](#new_ReactionCollector_new) |
| 20 | + * _instance_ |
| 21 | + * [.run(message, [options])](#ReactionCollector+run) ⇒ <code>Promise.<Map.<String, Message>></code> |
| 22 | + * [.getCollectors(message)](#ReactionCollector+getCollectors) ⇒ <code>Array.<CollectorContainer.<Message>></code> |
| 23 | + * [._onMessageReactionAdd(msg, emoji, userID)](#ReactionCollector+_onMessageReactionAdd) |
| 24 | + * [._onMessageReactionRemove(msg, emoji, userID)](#ReactionCollector+_onMessageReactionRemove) |
| 25 | + * [._onMessageReactionRemoveAll(msg)](#ReactionCollector+_onMessageReactionRemoveAll) |
| 26 | + * [._onMessageReactionRemoveEmoji(msg, emoji)](#ReactionCollector+_onMessageReactionRemoveEmoji) |
| 27 | + * _static_ |
| 28 | + * [.ReactionCollector](#ReactionCollector.ReactionCollector) |
| 29 | + * [new ReactionCollector(client, [options])](#new_ReactionCollector.ReactionCollector_new) |
| 30 | + |
| 31 | +<a name="new_ReactionCollector_new"></a> |
| 32 | + |
| 33 | +### new ReactionCollector() |
| 34 | +Collect bunch of message object according to chosen options |
| 35 | + |
| 36 | +<a name="ReactionCollector+run"></a> |
| 37 | + |
| 38 | +### reactionCollector.run(message, [options]) ⇒ <code>Promise.<Map.<String, Message>></code> |
| 39 | +Runs the message collector |
| 40 | + |
| 41 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 42 | +**Returns**: <code>Promise.<Map.<String, Message>></code> - Map of messages collected. |
| 43 | + |
| 44 | +| Param | Type | Description | |
| 45 | +| --- | --- | --- | |
| 46 | +| message | <code>Message</code> | The message object to listen to | |
| 47 | +| [options] | <code>Object</code> | The options for the reaction collector | |
| 48 | +| [options.timeout] | <code>Number</code> | The time before the collector times out in milliseconds | |
| 49 | +| [options.count] | <code>Number</code> | The amount of reactions to collect before automatically ending | |
| 50 | +| [options.ignoreBots] | <code>Boolean</code> | Whether or not to ignore bots | |
| 51 | +| [options.userID] | <code>String</code> | The user id to listen for (listens to all messages if not specified) | |
| 52 | +| [options.emojis] | <code>Array.<String></code> | The specific reactions to collect (collects all reactions if not specified) | |
| 53 | + |
| 54 | +**Example** |
| 55 | +```js |
| 56 | +const reactions = await collector.run(msg, { count: 10 }); |
| 57 | +``` |
| 58 | +<a name="ReactionCollector+getCollectors"></a> |
| 59 | + |
| 60 | +### reactionCollector.getCollectors(message) ⇒ <code>Array.<CollectorContainer.<Message>></code> |
| 61 | +Get all CollectorContainers that will collect from this particular message |
| 62 | + |
| 63 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 64 | + |
| 65 | +| Param | Type | |
| 66 | +| --- | --- | |
| 67 | +| message | <code>Message</code> | |
| 68 | + |
| 69 | +<a name="ReactionCollector+_onMessageReactionAdd"></a> |
| 70 | + |
| 71 | +### reactionCollector.\_onMessageReactionAdd(msg, emoji, userID) |
| 72 | +Function bound to messageReactionAdd event. |
| 73 | +Collect the reaction for all collectors that respond to the criteria |
| 74 | +Emits collect event. |
| 75 | + |
| 76 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 77 | + |
| 78 | +| Param | Type | |
| 79 | +| --- | --- | |
| 80 | +| msg | <code>Message</code> | |
| 81 | +| emoji | <code>Emoji</code> | |
| 82 | +| userID | <code>String</code> | |
| 83 | + |
| 84 | +<a name="ReactionCollector+_onMessageReactionRemove"></a> |
| 85 | + |
| 86 | +### reactionCollector.\_onMessageReactionRemove(msg, emoji, userID) |
| 87 | +Function bound to messageReactionRemove event. |
| 88 | +Remove the reaction from all collectors that collected this reaction |
| 89 | + |
| 90 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 91 | + |
| 92 | +| Param | Type | |
| 93 | +| --- | --- | |
| 94 | +| msg | <code>Message</code> | |
| 95 | +| emoji | <code>Emoji</code> | |
| 96 | +| userID | <code>String</code> | |
| 97 | + |
| 98 | +<a name="ReactionCollector+_onMessageReactionRemoveAll"></a> |
| 99 | + |
| 100 | +### reactionCollector.\_onMessageReactionRemoveAll(msg) |
| 101 | +Function bound to messageReactionRemoveAll event. |
| 102 | +Updates the reaction from all collectors that collected this reaction |
| 103 | + |
| 104 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 105 | + |
| 106 | +| Param | Type | |
| 107 | +| --- | --- | |
| 108 | +| msg | <code>Message</code> | |
| 109 | + |
| 110 | +<a name="ReactionCollector+_onMessageReactionRemoveEmoji"></a> |
| 111 | + |
| 112 | +### reactionCollector.\_onMessageReactionRemoveEmoji(msg, emoji) |
| 113 | +Function bound to messageReactionRemoveEmoji event. |
| 114 | +Updates the reaction from all collectors that collected this reaction |
| 115 | + |
| 116 | +**Kind**: instance method of [<code>ReactionCollector</code>](#ReactionCollector) |
| 117 | + |
| 118 | +| Param | Type | |
| 119 | +| --- | --- | |
| 120 | +| msg | <code>Message</code> | |
| 121 | +| emoji | <code>Emoji</code> | |
| 122 | + |
| 123 | +<a name="ReactionCollector.ReactionCollector"></a> |
| 124 | + |
| 125 | +### ReactionCollector.ReactionCollector |
| 126 | +**Kind**: static class of [<code>ReactionCollector</code>](#ReactionCollector) |
| 127 | +<a name="new_ReactionCollector.ReactionCollector_new"></a> |
| 128 | + |
| 129 | +#### new ReactionCollector(client, [options]) |
| 130 | +Creates an instance of ReactionCollector |
| 131 | + |
| 132 | + |
| 133 | +| Param | Type | Default | Description | |
| 134 | +| --- | --- | --- | --- | |
| 135 | +| client | <code>[AxonClient](AxonClient)</code> | | The axon client object | |
| 136 | +| [options] | <code>Object</code> | | The default options for the reaction collector instance | |
| 137 | +| [options.timeout] | <code>Number</code> | <code>10000</code> | The time before the collector times out in milliseconds | |
| 138 | +| [options.count] | <code>Number</code> | <code>10</code> | The amount of reactions to collect before automatically ending | |
| 139 | +| [options.ignoreBots] | <code>Boolean</code> | <code>true</code> | Whether or not to ignore bots | |
| 140 | +| [options.userID] | <code>String</code> | | The user id to listen for (listens to all reactions if not specified) | |
| 141 | +| [options.emojis] | <code>Array.<String></code> | | The specific reactions to collect (collects all reactions if not specified) | |
| 142 | + |
| 143 | +**Example** |
| 144 | +```js |
| 145 | +const collector = new ReactionCollector(this.axon, { count: 10, ignoreBots: false }); |
| 146 | +``` |
0 commit comments