aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--velascobot2/bot.py2
-rw-r--r--velascobot2/database.py8
-rw-r--r--velascobot2/messenger.py4
-rw-r--r--velascobot2/parrot.py4
4 files changed, 18 insertions, 0 deletions
diff --git a/velascobot2/bot.py b/velascobot2/bot.py
index 2a997ff..51ed5e3 100644
--- a/velascobot2/bot.py
+++ b/velascobot2/bot.py
@@ -383,6 +383,8 @@ class Bot:
pass
async def wake_up(self, exclusive: bool = False) -> None:
+ self.messenger.fix_all_chats()
+
if not self.messenger.wake_up:
return
if len(self.motd_list) == 0:
diff --git a/velascobot2/database.py b/velascobot2/database.py
index 582495f..156f1f5 100644
--- a/velascobot2/database.py
+++ b/velascobot2/database.py
@@ -241,6 +241,14 @@ class Database:
)
return count
+ # I made an oopsie when converting the old jsons to sqlite. I will remove this in the next commit
+ def fix_all_chats(self):
+ with _SQLiteContextMgr(database=self.db_name) as db:
+ db.execute(
+ "UPDATE vocab SET key = ? WHERE key = ?",
+ ('', ' ')
+ )
+
def get_all_chats(self) -> list[ChatData]:
with _SQLiteContextMgr(database=self.db_name) as db:
rows = db.execute("SELECT * FROM chats").fetchall()
diff --git a/velascobot2/messenger.py b/velascobot2/messenger.py
index 7298cac..c328d92 100644
--- a/velascobot2/messenger.py
+++ b/velascobot2/messenger.py
@@ -138,3 +138,7 @@ class Messenger:
def update_set_silenced(self, chat_id: str, silenced: bool):
self._parrot.update_chat_set_silenced(chat_id, silenced)
+
+ # I made an oopsie when converting the old jsons to sqlite. I will remove this in the next commit
+ def fix_all_chats(self):
+ self._parrot.fix_all_chats()
diff --git a/velascobot2/parrot.py b/velascobot2/parrot.py
index 9ca139a..02e5495 100644
--- a/velascobot2/parrot.py
+++ b/velascobot2/parrot.py
@@ -133,3 +133,7 @@ class Parrot:
def update_chat_set_silenced(self, chat_id: str, silenced: bool):
self.db.update_chat_set_silenced(chat_id, silenced)
+
+ # I made an oopsie when converting the old jsons to sqlite. I will remove this in the next commit
+ def fix_all_chats(self):
+ self.db.fix_all_chats()