Created the ready.cpp

This commit is contained in:
Mathias Wagner 2023-10-29 14:23:24 +01:00
parent 12f09c7e9a
commit 29ab86365f
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

26
src/listeners/ready.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "ready.h"
const std::chrono::seconds statusChangeInterval(15);
std::thread ready::get_status_thread(dpp::cluster &bot) {
return std::thread([&bot]() {
while (true) {
bot.set_presence(dpp::presence(dpp::ps_online, dpp::at_watching, "support.sheepstar.xyz"));
std::this_thread::sleep_for(statusChangeInterval);
bot.set_presence(dpp::presence(dpp::ps_online, dpp::at_listening, "/help"));
std::this_thread::sleep_for(statusChangeInterval);
bot.set_presence(dpp::presence(dpp::ps_online, dpp::at_watching, "sheepstar.xyz"));
std::this_thread::sleep_for(statusChangeInterval);
}
});
}
void ready::execute(dpp::cluster &bot, const dpp::ready_t &event) {
std::cout << "Logged in as " << event.from->creator->me.username << " (" << event.from->creator->me.id << ")"
<< std::endl;
std::thread status_thread = get_status_thread(bot);
status_thread.join();
}