aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-02-04 12:22:14 +0100
committerGuillermo Serrahima <dev@vylion.com>2026-02-04 12:22:14 +0100
commite45e87106a51a17c2b19f7c8704b5a0ef436597d (patch)
treee49988c5dffa19d8c26065bb65e6332e0d57aad4
parent5ddae470ce5ffbf8d6bb1bedc3b6b411aff802bc (diff)
downloadvelascobot2-e45e87106a51a17c2b19f7c8704b5a0ef436597d.tar.xz
velascobot2-e45e87106a51a17c2b19f7c8704b5a0ef436597d.zip
Removed 'processed_messages' column
-rw-r--r--velascobot2/database.py9
-rw-r--r--velascobot2/parrot.py2
-rw-r--r--velascobot2/utils.py9
3 files changed, 3 insertions, 17 deletions
diff --git a/velascobot2/database.py b/velascobot2/database.py
index 8be2b8c..6a1b648 100644
--- a/velascobot2/database.py
+++ b/velascobot2/database.py
@@ -57,7 +57,6 @@ class Database:
id TEXT PRIMARY KEY,
type TEXT NOT NULL,
name TEXT NOT NULL,
- processed_messages INTEGER DEFAULT 0,
message_period INTEGER DEFAULT 10,
answer_chance REAL DEFAULT 0.5,
restricted INTEGER DEFAULT 0,
@@ -222,14 +221,6 @@ class Database:
(int(silenced), chat_id),
)
- def incr_processed_messages(self, chat_id: str):
- with _SQLiteContextMgr(database=self.db_name) as db:
- db.execute(
- "UPDATE chats SET processed_messages = processed_messages + ?"
- " WHERE id = ?",
- (1, chat_id),
- )
-
def count_graphics(self, chat_id: str) -> int:
"""Returns the number of graphics stored for a given chat id."""
with _SQLiteContextMgr(database=self.db_name) as db:
diff --git a/velascobot2/parrot.py b/velascobot2/parrot.py
index 641dd31..be99e20 100644
--- a/velascobot2/parrot.py
+++ b/velascobot2/parrot.py
@@ -48,8 +48,6 @@ class Parrot:
for key, word, count in self.parse_words(words):
self.db.add_words(chat_id, key, word, count)
- self.db.incr_processed_messages(chat_id)
-
def parse_words(self, words: list[str]):
word_counts: dict[tuple[str, str], int] = {}
diff --git a/velascobot2/utils.py b/velascobot2/utils.py
index d9e929d..61b754e 100644
--- a/velascobot2/utils.py
+++ b/velascobot2/utils.py
@@ -21,7 +21,6 @@ class ChatData:
id: str,
chat_type: str,
name: str,
- processed_messages: int = 0,
message_period: int = 10,
answer_chance: float = 0.5,
restricted: bool = False,
@@ -30,22 +29,20 @@ class ChatData:
self.id = id
self.type = chat_type
self.name = name
- self.processed_messages = processed_messages
self.message_period = message_period
self.answer_chance = answer_chance
self.restricted = restricted
self.silenced = silenced
@staticmethod
- def from_sql_row(row: tuple[str, str, str, int, int, float, int, int]):
+ def from_sql_row(row: tuple[str, str, str, int, float, int, int]):
logger.debug(f"From SQL row: {repr(row)}")
return ChatData(
row[0],
row[1],
row[2],
int(row[3]),
- int(row[4]),
- float(row[5]),
+ float(row[4]),
+ int(row[5]) == 1,
int(row[6]) == 1,
- int(row[7]) == 1,
)