sparkle/sources/main.cpp

28 lines
964 B
C++
Raw Normal View History

2024-12-31 02:20:56 +05:00
#define RELEASE
#include <utils/json.hpp>
#include <utils/enums.hpp>
2025-01-13 14:40:21 +05:00
#include <tls/Network.hpp>
#include <gateway/Websocket.hpp>
2024-12-31 02:20:56 +05:00
#include <utils/types.hpp>
#include <api/Bot.hpp>
#include <api/Channel.hpp>
#include <api/Message.hpp>
#include <api/Embed.hpp>
#include <api/Author.hpp>
2025-01-13 14:40:21 +05:00
#include <api/User.hpp>
2024-12-31 02:20:56 +05:00
#include <utils/types.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;
WebSocket* bot = &WebSocket::getInstance(argv[2], 131071);
bot->on(GatewayEvents::READY, [](const Bot<Message, User, Author>& b) {
g(0, b.net)->send("939957962972229634", j("content", "started"));
2024-12-31 02:20:56 +05:00
});
2025-01-13 14:40:21 +05:00
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Bot<Message, User, Author>& b) {
if (!g(2, b.net)->isBot()) {
g(0, b.net)->send("939957962972229634", j("content", g(2, b.net)->content()));
cout << g(1, b.net)->extract({ "content" }).get<string>() << endl;
2024-12-31 02:20:56 +05:00
}
});
bot->start();
return 0;
}