forked from rcxpony/sparkle
33 lines
1.2 KiB
C++
33 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, [](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->once(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;
|
|
} |