Created the ready.cpp
This commit is contained in:
parent
12f09c7e9a
commit
29ab86365f
26
src/listeners/ready.cpp
Normal file
26
src/listeners/ready.cpp
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user