diff options
| author | ilotterytea <iltsu@alright.party> | 2024-04-30 01:19:08 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-04-30 01:19:08 +0500 |
| commit | 4046b21f91868f36da29a6694a4b9122f2203b33 (patch) | |
| tree | 8b605bfff31c91623d92e03ebd8c8bd420f7d5d8 /src | |
| parent | 2064d219e19550cd885bee103a06e3f1cb7bc8e2 (diff) | |
upd: Request struct now has field for pqxx::work
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/request.hpp | 2 | ||||
| -rw-r--r-- | src/commands/request_util.cpp | 8 | ||||
| -rw-r--r-- | src/commands/request_util.hpp | 4 | ||||
| -rw-r--r-- | src/handlers.cpp | 2 |
4 files changed, 11 insertions, 5 deletions
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 <optional> +#include <pqxx/pqxx> #include <string> #include "../irc/message.hpp" @@ -11,5 +12,6 @@ namespace bot::command { std::optional<std::string> subcommand_id; std::optional<std::string> message; const irc::Message<irc::MessageType::Privmsg> &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 <optional> +#include <pqxx/pqxx> #include "../constants.hpp" #include "../irc/message.hpp" @@ -10,7 +11,8 @@ namespace bot::command { std::optional<Request> generate_request( const command::CommandLoader &command_loader, - const irc::Message<irc::MessageType::Privmsg> &irc_message) { + const irc::Message<irc::MessageType::Privmsg> &irc_message, + const pqxx::work &work) { std::vector<std::string> 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 <optional> +#include <pqxx/pqxx> #include "../irc/message.hpp" #include "command.hpp" @@ -7,5 +8,6 @@ namespace bot::command { std::optional<Request> generate_request( const command::CommandLoader &command_loader, - const irc::Message<irc::MessageType::Privmsg> &irc_message); + const irc::Message<irc::MessageType::Privmsg> &irc_message, + const pqxx::work &work); } diff --git a/src/handlers.cpp b/src/handlers.cpp index bcf3245..cd6860a 100644 --- a/src/handlers.cpp +++ b/src/handlers.cpp @@ -18,7 +18,7 @@ namespace bot::handlers { const irc::Message<irc::MessageType::Privmsg> &message, const pqxx::work &work) { std::optional<command::Request> request = - command::generate_request(command_loader, message); + command::generate_request(command_loader, message, work); if (request.has_value()) { auto o_response = command_loader.run(bundle, request.value()); |
