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:
parent
c9b3a2d25f
commit
3fe5dcb881
1 changed files with 6 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue