sparkle/sources/main.cpp

34 lines
1.2 KiB
C++
Raw Normal View History

2024-12-31 02:20:56 +05:00
#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;
2024-12-31 04:46:39 +05:00
int main(int argc, char* argv[]) {
if (argc != 5) return -1;
WebSocket* bot = WebSocket::getInstance(argv[2], stoi(argv[4]), true);
2025-01-01 18:23:07 +05:00
bot->on(GatewayEvents::READY, [](const Bot<Message>& b) {
2024-12-31 02:20:56 +05:00
cout << "started" << endl;
});
2025-01-06 22:18:30 +05:00
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Bot<Message, Author, EmbedBuilder>& msg) {
if (g(1, msg.net)->isBot() == false) {
g(0, msg.net)->send("939957962972229634", j("content", g(1, msg.net)->content()));
2024-12-31 02:20:56 +05:00
}
});
2025-01-06 22:18:30 +05:00
bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [](const Bot<Message>& msg) {
2025-01-06 21:57:27 +05:00
g(0, msg.net)->send("939957962972229634",
j("content", "bye"));
2024-12-31 02:20:56 +05:00
});
2024-12-31 04:46:39 +05:00
bot->on(GatewayEvents::MESSAGE_REACTION_ADD, [](const Bot<Message>& msg) {
2024-12-31 02:20:56 +05:00
g(0, msg.net)->send("939957962972229634", j("content", "hello"));
});
bot->start();
return 0;
}