Решение:
Структура базы:
CREATE TABLE IF NOT EXISTS bot_data
(user_id INT PRIMARY KEY NOT NULL,
domain CHAR(64),
name CHAR(64),
last_req TIMESTAMP,
blocked BOOLEAN NOT NULL DEFAULT FALSE,
admin BOOLEAN NOT NULL DEFAULT FALSE,
in_chats int [] NOT NULL DEFAULT array[]::int[],
pm_started BOOLEAN NOT NULL DEFAULT FALSE);
Проверка на блокировку
def isUserBanned(self, id):
cur = self.con.cursor()
cur.execute("""
SELECT
blocked
FROM
bot_data
WHERE
user_id = %(id)s
""", {
'id': id
})
row = cur.fetchone()
row = list(row)
if row[0] == True:
return True
else:
return False