From d4e3141dd7c32fdb2c1a1583fbd63079642d1447 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 7 Dec 2025 18:01:41 +0500 Subject: feat: custom command aliases are retvrned back --- bot/src/handlers.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'bot') diff --git a/bot/src/handlers.cpp b/bot/src/handlers.cpp index 072c039..f473063 100644 --- a/bot/src/handlers.cpp +++ b/bot/src/handlers.cpp @@ -68,11 +68,14 @@ namespace bot::handlers { cid.size()); db::DatabaseRows cmds = conn->exec( - "SELECT name, message FROM custom_commands WHERE (name = $1 OR name " - "LIKE $2) " - "AND (channel_id " - "= $3 OR is_global = TRUE)", - {cid, cid_without_prefix, std::to_string(requester.channel.get_id())}); + "SELECT cc.name, cc.message FROM custom_commands cc " + "LEFT JOIN custom_command_aliases cca ON cca.command_id = cc.id " + "WHERE (cc.name = $1 OR cc.name " + "LIKE $2 OR cca.name = $3 OR cca.name LIKE $4) " + "AND (cc.channel_id " + "= $5 OR cc.is_global = TRUE)", + {cid, cid_without_prefix, cid, cid_without_prefix, + std::to_string(requester.channel.get_id())}); if (cmds.empty()) { return std::nullopt; -- cgit v1.2.3