Reaction collector. More...
#include "collector.h"
Public Member Functions | |
reaction_collector (cluster *cl, uint64_t duration, snowflake msg_id=0) | |
Construct a new reaction collector object. More... | |
virtual | ~reaction_collector ()=default |
Destroy the reaction collector object. More... | |
virtual void | cancel () |
Immediately cancels the collector. More... | |
virtual void | completed (const std::vector< C > &list)=0 |
You must implement this function to receive the completed list of captured objects. More... | |
virtual void | completed (const std::vector< dpp::collected_reaction > &list)=0 |
Return the completed collection. More... | |
virtual const dpp::collected_reaction * | filter (const dpp::message_reaction_add_t &element) |
Select and filter the items which are to appear in the list This is called every time a new event is fired, to filter the event and determine which of the items is sent to the list. More... | |
virtual const C * | filter (const T &element)=0 |
Filter the list of elements. More... | |
Protected Attributes | |
class cluster * | owner |
Owning cluster. More... | |
Reaction collector.
Collects message reactions during a set timeframe and returns them in a list via the completed() method.
|
inline |
Construct a new reaction collector object.
cl | cluster to associate the collector with |
duration | Duration of time to run the collector for in seconds |
msg_id | Optional message ID. If specified, only collects reactions for the given message |
References dpp::message_reaction_add_t::message_author_id, dpp::message_reaction_add_t::message_id, dpp::message_reaction_add_t::reacting_channel, dpp::message_reaction_add_t::reacting_emoji, dpp::message_reaction_add_t::reacting_guild, dpp::message_reaction_add_t::reacting_member, and dpp::message_reaction_add_t::reacting_user.
|
virtualdefault |
Destroy the reaction collector object.
|
inlinevirtualinherited |
Immediately cancels the collector.
Use this if you have met the conditions for which you are collecting objects early, e.g. you were watching for a message containing 'yes' or 'no' and have received it before the time is up.
|
pure virtualinherited |
You must implement this function to receive the completed list of captured objects.
list | The list of captured objects in captured order |
|
pure virtual |
Return the completed collection.
list | items collected during the timeframe specified |
|
inlinevirtual |
Select and filter the items which are to appear in the list This is called every time a new event is fired, to filter the event and determine which of the items is sent to the list.
Returning nullptr excludes the item from the list.
element | element to filter |
|
pure virtualinherited |
Filter the list of elements.
Every time an event is fired on the collector, this method wil be called to determine if we should add an object to the list or not. This function can then process the element
value, extract the parts which are to be saved to a list (e.g. a dpp::message out of a dpp::message_create_t) and return it as the return value. Returning a value of nullptr causes no object to be stored.
Here is an example of how to filter messages which have specific text in them. This should be used with the specialised type dpp::message_collector
element | The event data to filter |
|
protectedinherited |
Owning cluster.