From 4046b21f91868f36da29a6694a4b9122f2203b33 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 30 Apr 2024 01:19:08 +0500 Subject: upd: Request struct now has field for pqxx::work --- src/commands/request.hpp | 2 ++ src/commands/request_util.cpp | 8 +++++--- src/commands/request_util.hpp | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/commands') diff --git a/src/commands/request.hpp b/src/commands/request.hpp index 9742cbc..ee7bd11 100644 --- a/src/commands/request.hpp +++ b/src/commands/request.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include "../irc/message.hpp" @@ -11,5 +12,6 @@ namespace bot::command { std::optional subcommand_id; std::optional message; const irc::Message &irc_message; + const pqxx::work &work; }; } diff --git a/src/commands/request_util.cpp b/src/commands/request_util.cpp index af17623..1262a3d 100644 --- a/src/commands/request_util.cpp +++ b/src/commands/request_util.cpp @@ -1,6 +1,7 @@ #include "request_util.hpp" #include +#include #include "../constants.hpp" #include "../irc/message.hpp" @@ -10,7 +11,8 @@ namespace bot::command { std::optional generate_request( const command::CommandLoader &command_loader, - const irc::Message &irc_message) { + const irc::Message &irc_message, + const pqxx::work &work) { std::vector parts = utils::string::split_text(irc_message.message, ' '); @@ -35,7 +37,7 @@ namespace bot::command { parts.erase(parts.begin()); if (parts.empty()) { - Request req{command_id, std::nullopt, std::nullopt, irc_message}; + Request req{command_id, std::nullopt, std::nullopt, irc_message, work}; return req; } @@ -52,7 +54,7 @@ namespace bot::command { message = std::nullopt; } - Request req{command_id, subcommand_id, message, irc_message}; + Request req{command_id, subcommand_id, message, irc_message, work}; return req; } } diff --git a/src/commands/request_util.hpp b/src/commands/request_util.hpp index df61ba5..3d9831d 100644 --- a/src/commands/request_util.hpp +++ b/src/commands/request_util.hpp @@ -1,4 +1,5 @@ #include +#include #include "../irc/message.hpp" #include "command.hpp" @@ -7,5 +8,6 @@ namespace bot::command { std::optional generate_request( const command::CommandLoader &command_loader, - const irc::Message &irc_message); + const irc::Message &irc_message, + const pqxx::work &work); } -- cgit v1.2.3