From 710a89c282565d5d78bbf855fa3cc8857df55cfc Mon Sep 17 00:00:00 2001 From: b3yond Date: Fri, 26 Oct 2018 18:20:01 +0200 Subject: [PATCH] fix mailbot crash: File "/srv/ticketfrei/active_bots/mailbot.py", line 37, in post if rec not in report.author: TypeError: argument of type 'NoneType' is not iterable --- active_bots/telegrambot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index a65e38f..385c32d 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -45,6 +45,10 @@ class TelegramBot(Bot): "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: + # set report.author to "" to avoid mailbot crash + if update.message.sender.username is None: + update.message.sender.username = "" + reports.append(Report(update.message.sender.username, self, update.message.text, None, update.message.date))