D++ (DPP)
C++ Discord API Bot Library
Loading...
Searching...
No Matches
dpp::reaction_collector Class Referenceabstract

Reaction collector. Collects message reactions during a set timeframe and returns them in a list via the completed() method. More...

#include <collector.h>

Inheritance diagram for dpp::reaction_collector:
Collaboration diagram for dpp::reaction_collector:

Public Member Functions

 reaction_collector (cluster *cl, uint64_t duration, snowflake msg_id=0)
 Construct a new reaction collector object.
virtual ~reaction_collector ()=default
 Destroy the reaction collector object.
virtual void cancel ()
 Immediately cancels the collector.
virtual void completed (const std::vector< dpp::collected_reaction > &list)=0
 Return the completed collection.
virtual const dpp::collected_reactionfilter (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. Returning nullptr excludes the item from the list.

Protected Attributes

class clusterowner
 Owning cluster.

Detailed Description

Reaction collector. Collects message reactions during a set timeframe and returns them in a list via the completed() method.

Constructor & Destructor Documentation

◆ reaction_collector()

dpp::reaction_collector::reaction_collector ( cluster * cl,
uint64_t duration,
snowflake msg_id = 0 )
inline

Construct a new reaction collector object.

Parameters
clcluster to associate the collector with
durationDuration of time to run the collector for in seconds
msg_idOptional message ID. If specified, only collects reactions for the given message

◆ ~reaction_collector()

virtual dpp::reaction_collector::~reaction_collector ( )
virtualdefault

Destroy the reaction collector object.

Member Function Documentation

◆ cancel()

virtual void dpp::collector< dpp::message_reaction_add_t, dpp::collected_reaction >::cancel ( )
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.

Note
Causes calling of the completed() method if it has not yet been called.

◆ completed()

virtual void dpp::reaction_collector::completed ( const std::vector< dpp::collected_reaction > & list)
pure virtual

Return the completed collection.

Parameters
listitems collected during the timeframe specified

Implements dpp::collector< dpp::message_reaction_add_t, dpp::collected_reaction >.

◆ filter()

virtual const dpp::collected_reaction * dpp::reaction_collector::filter ( const dpp::message_reaction_add_t & element)
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.

Parameters
elementelement to filter
Returns
Returned item to add to the list, or nullptr to skip adding this element

Implements dpp::collector< dpp::message_reaction_add_t, dpp::collected_reaction >.

Member Data Documentation

◆ owner

Owning cluster.

D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0