mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-12-18 13:13:28 +00:00
스킵 구현
This commit is contained in:
26
DPP-master/docpages/example_code/using_cache.cpp
Normal file
26
DPP-master/docpages/example_code/using_cache.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
int main() {
|
||||
/* Create bot */
|
||||
dpp::cluster bot("token", dpp::i_default_intents | dpp::i_guild_members);
|
||||
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
/* This event is fired when someone removes their reaction from a message */
|
||||
bot.on_message_reaction_remove([&bot](const dpp::message_reaction_remove_t& event) {
|
||||
/* Find the user in the cache using his discord id */
|
||||
dpp::user* reacting_user = dpp::find_user(event.reacting_user_id);
|
||||
|
||||
/* If user not found in cache, log and return */
|
||||
if (!reacting_user) {
|
||||
bot.log(dpp::ll_info, "User with the id " + std::to_string(event.reacting_user_id) + " was not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
bot.log(dpp::ll_info, reacting_user->format_username() + " removed his reaction.");
|
||||
});
|
||||
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user