From cd3c8be2dca00edbc39f988dda59840e22e625e3 Mon Sep 17 00:00:00 2001 From: b3yond Date: Tue, 19 Feb 2019 16:16:21 +0100 Subject: [PATCH 1/4] fixed wrong exception --- active_bots/twitterbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/active_bots/twitterbot.py b/active_bots/twitterbot.py index 0efb14f..87e14f9 100755 --- a/active_bots/twitterbot.py +++ b/active_bots/twitterbot.py @@ -73,7 +73,7 @@ class TwitterBot(Bot): def post(self, user, report): try: api = self.get_api(user) - except IndexError: + except TypeError: return # no twitter account for this user. try: if report.source == self: From e18244e1493410371fe5197173b4d41f4fc8037c Mon Sep 17 00:00:00 2001 From: b3yond Date: Sat, 2 Feb 2019 22:02:56 +0100 Subject: [PATCH 2/4] don't log Mastodon 502 errors. --- active_bots/mastodonbot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/active_bots/mastodonbot.py b/active_bots/mastodonbot.py index 0189dca..416bb51 100755 --- a/active_bots/mastodonbot.py +++ b/active_bots/mastodonbot.py @@ -2,7 +2,7 @@ from bot import Bot import logging -from mastodon import Mastodon +from mastodon import Mastodon, MastodonServerError import re from report import Report @@ -25,8 +25,8 @@ class MastodonBot(Bot): return mentions try: notifications = m.notifications() - except Exception: - logger.error("Unknown Mastodon API Error.", exc_info=True) + except MastodonServerError: + logger.error("Unknown Mastodon API Error: 502") return mentions for status in notifications: if (status['type'] == 'mention' and From 7a7e8f0a302f03a68cf7d83f53962e98d9f23893 Mon Sep 17 00:00:00 2001 From: b3yond Date: Fri, 3 May 2019 12:06:11 +0200 Subject: [PATCH 3/4] Notify that telegram image reports are not supported. #90 --- active_bots/telegrambot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index 9fdbd66..a1aa9ef 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -32,6 +32,12 @@ class TelegramBot(Bot): logger.error("Unknown Telegram error code: " + str(update)) return reports user.save_seen_tg(update.update_id) + if update.message.photo: + tb.send_message( + update.message.sender.id, + "Sending Photos is not supported for privacy reasons. Can " + "you describe it in a report instead?") + continue if update.message.text.lower() == "/start": user.add_telegram_subscribers(update.message.sender.id) tb.send_message( From d1b11fe9322c2570dcd4cf3c8f05ba97b8128654 Mon Sep 17 00:00:00 2001 From: sid <25916907+git-sid@users.noreply.github.com> Date: Sat, 4 May 2019 10:22:03 +0200 Subject: [PATCH 4/4] Update active_bots/telegrambot.py Co-Authored-By: b3yond --- active_bots/telegrambot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index a1aa9ef..20c663c 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -36,7 +36,7 @@ class TelegramBot(Bot): tb.send_message( update.message.sender.id, "Sending Photos is not supported for privacy reasons. Can " - "you describe it in a report instead?") + "you describe it as text instead?") continue if update.message.text.lower() == "/start": user.add_telegram_subscribers(update.message.sender.id)