aboutsummaryrefslogtreecommitdiff
path: root/velascobot2
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-02-02 15:26:43 +0100
committerGuillermo Serrahima <dev@vylion.com>2026-02-02 15:26:43 +0100
commit5da9900ccc1e4313e488ec370b61bb945dbe4e18 (patch)
tree6f9f71a6266644edb6ea7d41aec2f25a2d77f268 /velascobot2
parent0c22d2ab77ff6be416e9e4a6d387f567a4920854 (diff)
downloadvelascobot2-5da9900ccc1e4313e488ec370b61bb945dbe4e18.tar.xz
velascobot2-5da9900ccc1e4313e488ec370b61bb945dbe4e18.zip
Fix all chats
Diffstat (limited to 'velascobot2')
-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()