#pragma once #include "debug/Log.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "util/RapidjsonHelpers.hpp" #include #include #include namespace chatterino { struct ActionUser; const rapidjson::Value &getArgs(const rapidjson::Value &data); bool getCreatedByUser(const rapidjson::Value &data, ActionUser &user); bool getTargetUser(const rapidjson::Value &data, ActionUser &user); rapidjson::Document createListenMessage( const std::vector &topicsVec, std::shared_ptr account); rapidjson::Document createUnlistenMessage( const std::vector &topicsVec); // Create timer using given ioService template void runAfter(boost::asio::io_service &ioService, Duration duration, Callback cb) { auto timer = std::make_shared(ioService); timer->expires_from_now(duration); timer->async_wait([timer, cb](const boost::system::error_code &ec) { if (ec) { log("Error in runAfter: {}", ec.message()); return; } cb(timer); }); } // Use provided timer template void runAfter(std::shared_ptr timer, Duration duration, Callback cb) { timer->expires_from_now(duration); timer->async_wait([timer, cb](const boost::system::error_code &ec) { if (ec) { log("Error in runAfter: {}", ec.message()); return; } cb(timer); }); } } // namespace chatterino