Compare commits
No commits in common. "8b35de51fc3df449813107badda99b929ee3e1d1" and "004327b4c2e34b98e708c0d837aac02edf772754" have entirely different histories.
8b35de51fc
...
004327b4c2
@ -183,12 +183,12 @@ public:
|
||||
int getIntents() const {
|
||||
return WebSocket::intents;
|
||||
}
|
||||
void on(const int event, std::function<void(const json&&)> handler) {
|
||||
void on(const int event, std::function<void(const json&)> handler) {
|
||||
eventHandlers[events[event].second] = [handler](const json& message) {
|
||||
handler(message.get<json>());
|
||||
};
|
||||
}
|
||||
void once(const int event, std::function<void(const json&&)> handler) {
|
||||
void once(const int event, std::function<void(const json&)> handler) {
|
||||
eventHandlers[events[event].second] = [event, handler, isCalled = false](const json& message) mutable {
|
||||
isCalled == false ? isCalled = true : 0, handler(message.get<json>());
|
||||
};
|
||||
|
@ -1,14 +1,8 @@
|
||||
#include <api.h>
|
||||
#include <includes.h>
|
||||
#include <vector>
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) return -1;
|
||||
WebSocket* bot = &WebSocket::getInstance(argv[2], ALL_INTENTS);
|
||||
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Bot<Message, User, Author>& msg) {
|
||||
if (!g(2, msg.net)->isBot()) {
|
||||
g(0, msg.net)->send("939957962972229634", j("content", g(2, msg.net)->content()));
|
||||
}
|
||||
});
|
||||
WebSocket* bot = &WebSocket::getInstance(argv[2], 131071);
|
||||
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Bot<Message, User, Author>& msg) {
|
||||
if (!g(2, msg.net)->isBot()) {
|
||||
g(0, msg.net)->send("939957962972229634", j("content", g(2, msg.net)->content()));
|
||||
@ -16,4 +10,4 @@ int main(int argc, char* argv[]) {
|
||||
});
|
||||
bot->start();
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user