diff --git a/.gitignore b/.gitignore index 01f9cb9..32d7e84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build/ -.vscode/ \ No newline at end of file +.vscode/ +libs/example.hpp \ No newline at end of file diff --git a/libs/api/Author.hpp b/libs/api/Author.hpp index bd054b7..d6ee818 100644 --- a/libs/api/Author.hpp +++ b/libs/api/Author.hpp @@ -1,13 +1,12 @@ #ifndef API_AUTHOR_HPP_ #define API_AUTHOR_HPP_ -#include +#include #include #include #include using std::string; using std::cout; using std::endl; -using json = nlohmann::json; class Author { private: json data; diff --git a/libs/api/Bot.hpp b/libs/api/Bot.hpp index 7b28518..0ea776c 100644 --- a/libs/api/Bot.hpp +++ b/libs/api/Bot.hpp @@ -1,6 +1,6 @@ #ifndef API_BOT_HPP_ #define API_BOT_HPP_ -#include +#include #include #include #include @@ -8,7 +8,6 @@ using std::string; using std::cout; using std::endl; -using json = nlohmann::json; template class Bot { private: diff --git a/libs/api/Channel.hpp b/libs/api/Channel.hpp index 9ece6e2..7ab16ed 100644 --- a/libs/api/Channel.hpp +++ b/libs/api/Channel.hpp @@ -1,6 +1,5 @@ #ifndef API_CHANNEL_HPP_ #define API_CHANNEL_HPP_ -#include #include #include #include @@ -10,7 +9,6 @@ using std::string; using std::cout; using std::endl; -using json = nlohmann::json; class Channel { private: json data; diff --git a/libs/api/Embed.hpp b/libs/api/Embed.hpp index 4b87932..169e764 100644 --- a/libs/api/Embed.hpp +++ b/libs/api/Embed.hpp @@ -1,13 +1,12 @@ #ifndef API_EMBED_HPP_ #define API_EMBED_HPP_ -#include +#include #include #include #include using std::string; using std::cout; using std::endl; -using json = nlohmann::json; class EmbedBuilder { private: json embed = { diff --git a/libs/api/Guild.hpp b/libs/api/Guild.hpp index 8885b20..b2b5a0c 100644 --- a/libs/api/Guild.hpp +++ b/libs/api/Guild.hpp @@ -1,6 +1,6 @@ #ifndef API_GUILD_HPP_ #define API_GUILD_HPP_ -#include +#include #include #include #include diff --git a/libs/api/Message.hpp b/libs/api/Message.hpp index 193be72..30ca120 100644 --- a/libs/api/Message.hpp +++ b/libs/api/Message.hpp @@ -1,16 +1,14 @@ #ifndef API_MESSAGE_HPP_ #define API_MESSAGE_HPP_ -#include +#include #include #include #include #include #include -#include using std::string; using std::cout; using std::endl; -using json = nlohmann::json; class Message { private: json data; diff --git a/libs/api/User.hpp b/libs/api/User.hpp index faf2a2e..c6e0365 100644 --- a/libs/api/User.hpp +++ b/libs/api/User.hpp @@ -1,16 +1,14 @@ #ifndef API_USER_HPP_ #define API_USER_HPP_ -#include +#include #include #include #include #include #include -#include using std::string; using std::cout; using std::endl; -using json = nlohmann::json; class User { private: json data; @@ -28,7 +26,7 @@ public: try { return data["d"]["author"]["bot"]; } - catch (std::exception& e) { + catch (...) { return false; } } diff --git a/libs/gateway/websocket.hpp b/libs/gateway/websocket.hpp index 24cf5ab..cb21b54 100644 --- a/libs/gateway/websocket.hpp +++ b/libs/gateway/websocket.hpp @@ -100,7 +100,7 @@ private: int heartbeat_interval, lastS; json payload = { {"op", 1},{"d", nullptr} }, id, res; std::unordered_map> 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::i = intents; WebSocket::isBot = isBot; diff --git a/libs/utils/types.hpp b/libs/utils/types.hpp index 3fe6d7d..c2962c7 100644 --- a/libs/utils/types.hpp +++ b/libs/utils/types.hpp @@ -5,6 +5,8 @@ #define je(...) {__VA_ARGS__} #define g(x, y) (std::get(y)) #define ALL_INTENTS 131071 +#include +using json = nlohmann::json; #include void chngcol(const std::string& text, int rBg, int gBg, int bBg) { std::cout << "\033[48;2;" << rBg << ";" << gBg << ";" << bBg << "m"; diff --git a/sources/main.cpp b/sources/main.cpp index 1b36fda..b6a944a 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -23,7 +23,8 @@ int main(int argc, char* argv[]) { } }); bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot& 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& msg) { g(0, msg.net)->send("939957962972229634", j("content", "hello"));