@@ -26,7 +26,11 @@ void Handler::initialize(cluster& bot, commandhandler& handler){
2626 log_dpp (log.message , " Internal Log" , log.severity );
2727 });
2828
29+ #if DPP_VERSION_LONG >= 0x00100100 // (dpp version 10.1.0)
30+ // Do nothing, owner will be set below in on_ready callback
31+ #else
2932 owner = bot.current_application_get_sync ().owner ;
33+ #endif
3034 auto cmd_type = GlobalSettings::instance ().DISCORD ->integration .command_type .get ();
3135 std::string prefix = GlobalSettings::instance ().DISCORD ->integration .command_prefix ;
3236
@@ -37,14 +41,34 @@ void Handler::initialize(cluster& bot, commandhandler& handler){
3741 }
3842
3943 bot.on_ready ([&bot, &handler, this ](const ready_t &){
44+ #if DPP_VERSION_LONG >= 0x00100100 // (dpp version 10.1.0)
45+ log_dpp (" Logged in as: " + bot.me .format_username () + " ." , " Ready" , ll_info);
46+ Handler::create_unified_commands (handler);
47+ bot.current_application_get ([&](const dpp::confirmation_callback_t & cc){
48+ if (cc.is_error ()){
49+ log_dpp (" Error getting application details: " + cc.get_error ().message , " Current App" , ll_error);
50+ return ;
51+ }
52+ dpp::application app = cc.get <dpp::application>();
53+ log_dpp (" Application Name: " + app.name , " Current App" , ll_info);
54+ log_dpp (" Application ID: " + std::to_string (app.id ), " Current App" , ll_info);
55+ owner = app.owner ;
56+ });
57+ #else
4058 log_dpp (" Logged in as: " + bot.current_user_get_sync ().format_username () + " ." , " Ready" , ll_info);
4159 Handler::create_unified_commands (handler);
60+ #endif
4261 });
4362
4463 bot.on_guild_create ([&bot, this ](const guild_create_t & event){
4564 try {
65+ #if DPP_VERSION_LONG >= 0x00100100 // (dpp version 10.1.0)
66+ std::string id = std::to_string (event.created .id );
67+ log_dpp (" Loaded guild: " + event.created .name + " (" + id + " )." , " Guild Create" , ll_info);
68+ #else
4669 std::string id = std::to_string (event.created ->id );
4770 log_dpp (" Loaded guild: " + event.created ->name + " (" + id + " )." , " Guild Create" , ll_info);
71+ #endif
4872 std::lock_guard<std::mutex> lg (m_count_lock);
4973 Utility::get_user_counts (bot, event);
5074 }catch (std::exception& e){
@@ -53,19 +77,35 @@ void Handler::initialize(cluster& bot, commandhandler& handler){
5377 });
5478
5579 bot.on_guild_member_add ([this ](const guild_member_add_t & event){
80+ #if DPP_VERSION_LONG >= 0x00100100 // (dpp version 10.1.0)
81+ std::string id = std::to_string (event.adding_guild .id );
82+ if (!user_counts.empty () && user_counts.count (id)){
83+ log_dpp (" New member joined " + event.adding_guild .name + " . Incrementing member count." , " Guild Member Add" , ll_info);
84+ user_counts.at (id)++;
85+ }
86+ #else
5687 std::string id = std::to_string (event.adding_guild ->id );
5788 if (!user_counts.empty () && user_counts.count (id)){
5889 log_dpp (" New member joined " + event.adding_guild ->name + " . Incrementing member count." , " Guild Member Add" , ll_info);
5990 user_counts.at (id)++;
6091 }
92+ #endif
6193 });
6294
6395 bot.on_guild_member_remove ([this ](const guild_member_remove_t & event){
96+ #if DPP_VERSION_LONG >= 0x00100100 // (dpp version 10.1.0)
97+ std::string id = std::to_string (event.removing_guild .id );
98+ if (!user_counts.empty () && user_counts.count (id)){
99+ log_dpp (" Member left " + event.removing_guild .name + " . Decrementing member count." , " Guild Member Remove" , ll_info);
100+ user_counts.at (id)--;
101+ }
102+ #else
64103 std::string id = std::to_string (event.removing_guild ->id );
65104 if (!user_counts.empty () && user_counts.count (id)){
66105 log_dpp (" Member left " + event.removing_guild ->name + " . Decrementing member count." , " Guild Member Remove" , ll_info);
67106 user_counts.at (id)--;
68107 }
108+ #endif
69109 });
70110
71111 bot.on_message_create ([&handler](const message_create_t & event){
0 commit comments