[Bot] Change SaveTimers to Replace instead of Insert. (#2951)

* [Bot] Change SaveTimers to Replace instead of Insert.

* [Bot] Change SaveTimers to Replace instead of Insert.

* fix formatting
This commit is contained in:
Aeadoin
2023-02-18 16:13:36 -05:00
committed by GitHub
parent 4ad3ebf36a
commit ddd98be383
+4 -1
View File
@@ -962,7 +962,10 @@ bool BotDatabase::SaveTimers(Bot* bot_inst)
if (bot_timers[timer_index] <= Timer::GetCurrentTime())
continue;
query = StringFormat("INSERT INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('%u', '%u', '%u')", bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]);
query = fmt::format(
"REPLACE INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('{}', '{}', '{}')",
bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
DeleteTimers(bot_inst->GetBotID());