2025-01-25 13:22:59 +05:00
|
|
|
#include <api.hpp>
|
|
|
|
#include <includes.hpp>
|
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);
|
2025-01-25 17:21:44 +05:00
|
|
|
bot->on(GatewayEvents::READY, [](const Discord<User>& b) {
|
|
|
|
auto& [user] = b.ctx();
|
|
|
|
std::cout << nlohmann::json::parse(user->me())["username"].get<std::string>() << std::endl;
|
2025-01-19 04:41:20 +05:00
|
|
|
});
|
2025-01-25 17:21:44 +05:00
|
|
|
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Discord<Message, User, Author, Message::Api>& msg) {
|
|
|
|
const auto& [message, user, author, _] = msg.ctx();
|
|
|
|
if (!author->isBot) {
|
|
|
|
message->send("939957962972229634", message->pack("content", author->avatar));
|
2025-01-25 11:24:56 +05:00
|
|
|
}
|
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
|
|
|
}
|