fixed telegram spam problem!!111

This commit is contained in:
b3yond 2018-09-09 18:06:12 +02:00
parent 9c27c4093a
commit 4924519ba7
2 changed files with 3 additions and 3 deletions

View file

@ -28,12 +28,12 @@ class TelegramBot(Bot):
tb.send_message(update.message.sender.id, "You are now unsubscribed from report notifications.")
# TODO: /stop message should be set in frontend
elif update.message.text.lower() == "/help":
tb.send_message(update.message.sender.id, "Send reports here to share them with other users. Use /start and /stop to be included/excluded.")
tb.send_message(update.message.sender.id, "Send reports here to share them with other users. Use /start and /stop to get reports or not.")
# TODO: /help message should be set in frontend
else:
reports.append(Report(update.message.sender.username, self,
update.message.text, None, update.message.date))
user.save_seen_tg(update.message.id)
user.save_seen_tg(update.update_id)
except AttributeError:
print(updates[0], updates[1]) # Telegram API returns an Error
return reports

View file

@ -187,7 +187,7 @@ schlitz
def get_seen_tg(self):
db.execute("SELECT tg_id FROM seen_telegrams WHERE user_id = ?;",
(self.uid,))
return db.cur.fetchone()
return db.cur.fetchone()[0]
def save_seen_tg(self, tg_id):
db.execute("UPDATE seen_telegrams SET tg_id = ? WHERE user_id = ?;",