diff --git a/.clang-tidy b/.clang-tidy index 9264304..651f804 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,7 @@ -Checks: > +Checks: + '-*, clang-analyzer-*, modernize-*, performance-*, bugprone-*, - cppcoreguidelines-* + cppcoreguidelines-*' diff --git a/libs/network/websocket.cpp b/libs/network/websocket.cpp index 3994a2c..d1fe805 100644 --- a/libs/network/websocket.cpp +++ b/libs/network/websocket.cpp @@ -1,9 +1,9 @@ #include "websocket.hpp" void EventEmitter::emit(const std::string& event, const nlohmann::json& data) { if (auto it = handlers.find(event); it != handlers.end()) { - for (const auto& handler : it->second) { + std::for_each(it->second.begin(), it->second.end(), [&data](const auto& handler) { handler(data); - } + }); } } void EventEmitter::getEvents() { @@ -30,9 +30,9 @@ void EventEmitter::off(const std::string& event, eventHandlers handler) { auto it = handlers.find(event); if (it != handlers.end()) { auto& vec = it->second; - vec.erase(std::remove_if(vec.begin(), vec.end(), [&handler](const eventHandlers& h) { + vec.erase(std::ranges::remove_if(vec, [&handler](const eventHandlers& h) { return h.target() == handler.target(); - }), vec.end()); + }).begin(), vec.end()); } } WebSocket::WebSocket(const std::string& token, int intents, bool isBot) : token(token), intents(intents), isBot(isBot) { @@ -55,7 +55,7 @@ WebSocket::WebSocket(const std::string& token, int intents, bool isBot) : token( } })}, {"status", "idle"}, - {"since", 91879201}, + {"since", 0}, {"afk", false} }} }} diff --git a/libs/network/websocket.hpp b/libs/network/websocket.hpp index df51b01..72faf65 100644 --- a/libs/network/websocket.hpp +++ b/libs/network/websocket.hpp @@ -1,6 +1,7 @@ #ifndef NETWORK_WEBSOCKET_HPP_ #define NETWORK_WEBSOCKET_HPP_ #include +#include #include #include class EventEmitter {