1
0
Fork 0
mirror of https://gitlab.com/niansa/SomeBot.git synced 2025-03-06 20:48:26 +01:00

Solved SQL logic error in message deletion

This commit is contained in:
niansa 2022-11-02 22:54:53 +01:00
parent c9b3a2d25f
commit 3fe5dcb881

View file

@ -449,6 +449,11 @@ public:
// Delete message everywhere
auto [bots, bots_lock] = bot->get_locked_property<std::vector<Bot*>>("main_all_instances");
for (auto bot : *bots) {
// Make sure module is enabled
if (!bot->is_module_enabled("Globalchat")) {
continue;
}
// Get all messages broadcasted
bot->db << "SELECT id, guild_id FROM globalchat_messages "
"WHERE primary_id = ?;"
<< std::to_string(primary_id)
@ -458,7 +463,7 @@ public:
"WHERE id = ?;"
<< guild_id_str
>> channel_id_str;
// If guild is management guild, only mark it as deleted
// If guild is management guild, only mark it as deleted, otherwise delete
if (guild_id_str != std::to_string(bot->config.management_guild_id)) {
bot->cluster.message_delete(message_id_str, channel_id_str);
} else {