From 91e84bfd67c720e3a0ac9a0e0e32818e8232ced2 Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Sun, 22 May 2022 21:40:01 +0000 Subject: [PATCH] add get_user method --- database_interaction.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database_interaction.py b/database_interaction.py index 14c40e2..0b7e717 100644 --- a/database_interaction.py +++ b/database_interaction.py @@ -12,6 +12,11 @@ class Database(): self.cur.execute('INSERT INTO users (telegram_id) VALUES (:telegram_id)', {'telegram_id': telegram_id}) return self.cur.lastrowid + def get_user(self, telegram_id: str) -> tuple | None: + self.cur.execute('SELECT id FROM users WHERE telegram_id = :telegram_id', {'telegram_id': telegram_id}) + id = self.cur.fetchone() + return id + def add_rss_feed(): pass @@ -28,4 +33,4 @@ class Database(): pass def storing_feed_content(): - pass + pass \ No newline at end of file