From 6e0d3ace4751411957ed8119f0c3060544605254 Mon Sep 17 00:00:00 2001
From: fluttershy <a@a.a>
Date: Thu, 30 Jan 2025 23:21:16 +0500
Subject: [PATCH] for each

---
 .clang-tidy                |  5 +++--
 libs/network/websocket.cpp | 10 +++++-----
 libs/network/websocket.hpp |  1 +
 3 files changed, 9 insertions(+), 7 deletions(-)

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<eventHandlers>() == handler.target<eventHandlers>();
-        }), 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 <includes.hpp>
+#include <ranges>
 #include <ixwebsocket/IXNetSystem.h>
 #include <ixwebsocket/IXWebSocket.h>
 class EventEmitter {