aboutsummaryrefslogtreecommitdiffstats
path: root/database.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-03 14:35:53 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-03 14:35:53 -0700
commitf79ddc9f9825c32c74bcb29422a54203c81a00dd (patch)
treee04f92c334dd197facf3e15cd0d8ed6e1ae1f69c /database.py
parentc2fb5403dd16f0b43f6d1f43e6f1fd42b9ec7862 (diff)
initial fcm cloud messaging trigger in generate script
Diffstat (limited to 'database.py')
-rw-r--r--database.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/database.py b/database.py
index 2f6ae9a..f23848d 100644
--- a/database.py
+++ b/database.py
@@ -147,3 +147,14 @@ class Database:
return None
is_news = True if result[0] == 1 else False
return is_news, result[1]
+
+ def check_news_id_exists(self, key: str) -> bool:
+ """
+ Check if a news entry with the given ID exists in the database.
+
+ :param key: The ID of the news entry to check.
+ :return: True if the news entry exists, False otherwise.
+ """
+ self._cursor.execute("SELECT 1 FROM news WHERE news_id = ?", (key,))
+ result = self._cursor.fetchone()
+ return result is not None
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage