small fixes
This commit is contained in:
parent
61a4ce5e61
commit
8ccf76e479
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
build/
|
build/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
libs/example.hpp
|
@ -1,13 +1,12 @@
|
|||||||
#ifndef API_AUTHOR_HPP_
|
#ifndef API_AUTHOR_HPP_
|
||||||
#define API_AUTHOR_HPP_
|
#define API_AUTHOR_HPP_
|
||||||
#include <utils/json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
class Author {
|
class Author {
|
||||||
private:
|
private:
|
||||||
json data;
|
json data;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef API_BOT_HPP_
|
#ifndef API_BOT_HPP_
|
||||||
#define API_BOT_HPP_
|
#define API_BOT_HPP_
|
||||||
#include <utils/json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -8,7 +8,6 @@
|
|||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
template<typename...Args>
|
template<typename...Args>
|
||||||
class Bot {
|
class Bot {
|
||||||
private:
|
private:
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#ifndef API_CHANNEL_HPP_
|
#ifndef API_CHANNEL_HPP_
|
||||||
#define API_CHANNEL_HPP_
|
#define API_CHANNEL_HPP_
|
||||||
#include <utils/json.hpp>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -10,7 +9,6 @@
|
|||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
class Channel {
|
class Channel {
|
||||||
private:
|
private:
|
||||||
json data;
|
json data;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#ifndef API_EMBED_HPP_
|
#ifndef API_EMBED_HPP_
|
||||||
#define API_EMBED_HPP_
|
#define API_EMBED_HPP_
|
||||||
#include <utils/json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
class EmbedBuilder {
|
class EmbedBuilder {
|
||||||
private:
|
private:
|
||||||
json embed = {
|
json embed = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef API_GUILD_HPP_
|
#ifndef API_GUILD_HPP_
|
||||||
#define API_GUILD_HPP_
|
#define API_GUILD_HPP_
|
||||||
#include <json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
#ifndef API_MESSAGE_HPP_
|
#ifndef API_MESSAGE_HPP_
|
||||||
#define API_MESSAGE_HPP_
|
#define API_MESSAGE_HPP_
|
||||||
#include <utils/json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <tls/network.hpp>
|
#include <tls/network.hpp>
|
||||||
#include <gateway/websocket.hpp>
|
#include <gateway/websocket.hpp>
|
||||||
#include <utils/types.hpp>
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
class Message {
|
class Message {
|
||||||
private:
|
private:
|
||||||
json data;
|
json data;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
#ifndef API_USER_HPP_
|
#ifndef API_USER_HPP_
|
||||||
#define API_USER_HPP_
|
#define API_USER_HPP_
|
||||||
#include <json.hpp>
|
#include <utils/types.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <tls/network.hpp>
|
#include <tls/network.hpp>
|
||||||
#include <gateway/websocket.hpp>
|
#include <gateway/websocket.hpp>
|
||||||
#include <utils/types.hpp>
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using json = nlohmann::json;
|
|
||||||
class User {
|
class User {
|
||||||
private:
|
private:
|
||||||
json data;
|
json data;
|
||||||
@ -28,7 +26,7 @@ public:
|
|||||||
try {
|
try {
|
||||||
return data["d"]["author"]["bot"];
|
return data["d"]["author"]["bot"];
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ private:
|
|||||||
int heartbeat_interval, lastS;
|
int heartbeat_interval, lastS;
|
||||||
json payload = { {"op", 1},{"d", nullptr} }, id, res;
|
json payload = { {"op", 1},{"d", nullptr} }, id, res;
|
||||||
std::unordered_map<std::string_view, std::function<void(const json&)>> eventHandlers;
|
std::unordered_map<std::string_view, std::function<void(const json&)>> eventHandlers;
|
||||||
WebSocket(const std::string& token, const int intents, bool isBot) : lastS(0), heartbeat_interval(-1) {
|
WebSocket(const std::string& token, const int& intents, bool& isBot) : lastS(0), heartbeat_interval(-1) {
|
||||||
WebSocket::t = token;
|
WebSocket::t = token;
|
||||||
WebSocket::i = intents;
|
WebSocket::i = intents;
|
||||||
WebSocket::isBot = isBot;
|
WebSocket::isBot = isBot;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#define je(...) {__VA_ARGS__}
|
#define je(...) {__VA_ARGS__}
|
||||||
#define g(x, y) (std::get<x>(y))
|
#define g(x, y) (std::get<x>(y))
|
||||||
#define ALL_INTENTS 131071
|
#define ALL_INTENTS 131071
|
||||||
|
#include <utils/json.hpp>
|
||||||
|
using json = nlohmann::json;
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
void chngcol(const std::string& text, int rBg, int gBg, int bBg) {
|
void chngcol(const std::string& text, int rBg, int gBg, int bBg) {
|
||||||
std::cout << "\033[48;2;" << rBg << ";" << gBg << ";" << bBg << "m";
|
std::cout << "\033[48;2;" << rBg << ";" << gBg << ";" << bBg << "m";
|
||||||
|
@ -23,7 +23,8 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot<Message>& msg) {
|
bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot<Message>& msg) {
|
||||||
g(0, msg.net)->send("939957962972229634", j("content", "bye"));
|
g(0, msg.net)->send("939957962972229634",
|
||||||
|
j("content", "bye"));
|
||||||
});
|
});
|
||||||
bot->on(GatewayEvents::MESSAGE_REACTION_ADD, [](const Bot<Message>& msg) {
|
bot->on(GatewayEvents::MESSAGE_REACTION_ADD, [](const Bot<Message>& msg) {
|
||||||
g(0, msg.net)->send("939957962972229634", j("content", "hello"));
|
g(0, msg.net)->send("939957962972229634", j("content", "hello"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user