This repository has been archived on 2025-03-15. You can view files and clone it, but cannot push or open issues or pull requests.
sparkle/sources/main.cpp
fluttershy 0a3f012f1d rpc
2024-12-31 06:32:29 +05:00

34 lines
1.2 KiB
C++

#define RELEASE
#include <utils/json.hpp>
#include <utils/enums.hpp>
#include <tls/network.hpp>
#include <gateway/websocket.hpp>
#include <utils/types.hpp>
#include <api/Bot.hpp>
#include <api/Channel.hpp>
#include <api/Message.hpp>
#include <api/Embed.hpp>
#include <api/Author.hpp>
#include <utils/types.hpp>
using namespace std;
int main(int argc, char* argv[]) {
if (argc != 5) return -1;
WebSocket* bot = WebSocket::getInstance(argv[2], stoi(argv[4]), true);
bot->once(GatewayEvents::READY, [](const Bot<json>& b) {
cout << "started" << endl;
});
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->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) {
g(0, msg.net)->send("939957962972229634", j("content", "hello"));
});
bot->start();
return 0;
}