forked from ticketfrei/ticketfrei
modified telegram bot subscribe implementation
This commit is contained in:
commit
1d9c5f3c01
|
@ -15,17 +15,22 @@ class TelegramBot(Bot):
|
||||||
for update in updates:
|
for update in updates:
|
||||||
if update.message.text.lower() == "/start":
|
if update.message.text.lower() == "/start":
|
||||||
user.add_telegram_subscribers(update.message.from.id)
|
user.add_telegram_subscribers(update.message.from.id)
|
||||||
tb.send_message(update.message.from.id, "You are now subscribed to report notifications.") #TODO: /start message should be set in frontend
|
tb.send_message(update.message.from.id, "You are now \
|
||||||
|
subscribed to report notifications.")
|
||||||
|
#TODO: /start message should be set in frontend
|
||||||
elif update.message.text.lower() == "/stop":
|
elif update.message.text.lower() == "/stop":
|
||||||
user.remove_telegram_subscribers(update.message.from.id)
|
user.remove_telegram_subscribers(update.message.from.id)
|
||||||
tb.send_message(update.message.from.id, "You are now unsubscribed from report notifications.") #TODO: /stop message should be set in frontend
|
tb.send_message(update.message.from.id, "You are now \
|
||||||
|
unsubscribed from report notifications.")
|
||||||
|
#TODO: /stop message should be set in frontend
|
||||||
elif update.message.text.lower() == "/help":
|
elif update.message.text.lower() == "/help":
|
||||||
tb.send_message(update.message.from.id, "Send reports here to share them with other users. Use /start and /stop to be included/excluded.") #TODO: /help message should be set in frontend
|
tb.send_message(update.message.from.id, "Send reports here to \
|
||||||
|
share them with other users. Use /start and /stop to \
|
||||||
|
be included/excluded.")
|
||||||
|
#TODO: /help message should be set in frontend
|
||||||
else:
|
else:
|
||||||
for row in user.get_telegram_subscribers():
|
reports.append(Report(update.message.from.username,self,
|
||||||
if update.message.from.id == row[0]:
|
update.message.text,None,update.message.date))
|
||||||
reports.append(Report(update.message.from.username, self, update.message.text, None, update.message.date))
|
|
||||||
break
|
|
||||||
return reports
|
return reports
|
||||||
|
|
||||||
def post(self, user, report):
|
def post(self, user, report):
|
||||||
|
|
Loading…
Reference in a new issue