This commit is contained in:
fluttershy 2024-12-31 06:32:29 +05:00
parent 90e311c01a
commit 0a3f012f1d
3 changed files with 13 additions and 5 deletions

View File

@ -141,7 +141,6 @@ private:
heartbeat_interval = res["d"]["heartbeat_interval"].get<int>();
!connected ? connected = true, webSocket.send(id.dump()) : false;
start_heartbeat();
//test();
break;
case 0:
if (eventHandlers.find(res["t"].get<std::string>()) != eventHandlers.end()) {
@ -158,8 +157,8 @@ public:
json prsUpdate = {
{"op", 3},
{"d", {
{"since", 9187921},
{"activities", json::array({{"name", activityName}, {"type", statusType}})},
{"since", 0},
{"activities", json::array({{"name", activityName}, {"type", 2}})},
{"status", statusType == 1 ? "online" : "idle"},
{"afk", false}
}}

View File

@ -100,4 +100,12 @@ enum GatewayIntents {
GuildWebhooks = 32,
MessageContent = 32768
};
enum UserStatus {
Offline,
Online,
Idle,
AFK,
DoNotDisturb,
Invisible
};
#endif

View File

@ -17,12 +17,13 @@ int main(int argc, char* argv[]) {
bot->once(GatewayEvents::READY, [](const Bot<json>& b) {
cout << "started" << endl;
});
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Bot<json, Message, Author, EmbedBuilder>& msg) {
bot->on(GatewayEvents::MESSAGE_CREATE, [bot](const Bot<json, Message, Author, EmbedBuilder>& msg) {
if (g(2, msg.net)->isBot() == false) {
cout << g(1, msg.net)->send("939957962972229634", j("content", "test")) << endl;
}
//bot->sendPresenceUpdate(UserStatus::Online, "sd");
});
bot->once(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot<Message>& msg) {
bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot<Message>& msg) {
g(0, msg.net)->send("939957962972229634", j("content", "bye"));
});
bot->on(GatewayEvents::MESSAGE_REACTION_ADD, [](const Bot<Message>& msg) {