Sometimes you may need information that is not directly available in the event callback object.
To handle this DPP maintains a cache of commonly used data for you.
- Note
- As of August 30th, 2022, Discord made Guild Members a privileged intent. You must have GUILD_MEMBERS intent enabled for your app from discord developers portal to be able to look for members in cache.
Below is an example showing how to get a user from the cache
#include <dpp/dpp.h>
int main() {
if (!reacting_user) {
return;
}
});
return 0;
}
The cluster class represents a group of shards and a command queue for sending and receiving commands...
Definition: cluster.h:80
Represents a user on discord. May or may not be a member of a dpp::guild.
Definition: user.h:88
std::string format_username() const
Format a username into user#discriminator.
std::function< void(const dpp::log_t &)> DPP_EXPORT cout_logger()
Get a default logger that outputs to std::cout. e.g.
@ i_guild_members
Intent for receipt of guild members.
Definition: intents.h:42
@ i_default_intents
Default D++ intents (all non-privileged intents).
Definition: intents.h:132
@ ll_info
Information.
Definition: misc-enum.h:71
DPP_EXPORT class user * find_user(snowflake id)
@ st_wait
Wait forever on a condition variable. The cluster will spawn threads for each shard and start() will ...
Definition: cluster.h:63
Message reaction remove.
Definition: dispatcher.h:1183
dpp::snowflake reacting_user_id
User who reacted.
Definition: dispatcher.h:1195
DPP caches more than just users, which you can get using the below-mentioned functions: