aboutsummaryrefslogtreecommitdiffstats
path: root/database.py
diff options
context:
space:
mode:
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