sparkle/sources/main.cpp

17 lines
769 B
C++
Raw Normal View History

2025-01-15 13:34:41 +05:00
#include <api.h>
#include <includes.h>
2024-12-31 04:46:39 +05:00
int main(int argc, char* argv[]) {
2025-01-13 14:40:21 +05:00
if (argc != 3) return -1;
2025-01-20 15:07:30 +05:00
WebSocket* bot = &WebSocket::getInstance(argv[2], GatewayIntents::AllIntents);
bot->on(GatewayEvents::READY, [](const Discord<Message, User>& a) {
2025-01-25 11:24:56 +05:00
std::cout << DiscordEndpoints::details::latest << std::endl;
2025-01-19 04:41:20 +05:00
});
2025-01-25 11:24:56 +05:00
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Discord<Message, User, Author, Message::Api>& msg) {
if (msg.get<2>().isBot == false) {
msg.get<0>().send("939957962972229634", msg.get<0>().pack("content", std::to_string(msg.get<3>().latency()) + "ms"));
msg.get<0>().send("939957962972229634", msg.get<0>().pack("content", msg.get<2>().avatar));
}
2025-01-18 00:13:18 +05:00
});
2024-12-31 02:20:56 +05:00
bot->start();
return 0;
2025-01-19 04:41:20 +05:00
}