From f79ddc9f9825c32c74bcb29422a54203c81a00dd Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Fri, 3 Oct 2025 14:35:53 -0700 Subject: initial fcm cloud messaging trigger in generate script --- database.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'database.py') 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 -- cgit v1.2.3