Merge pull request #96 from ticketfrei/master

2.1.4 Release
This commit is contained in:
b3yond 2019-05-17 20:55:35 +02:00 committed by GitHub
commit d60ec173ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
from bot import Bot from bot import Bot
import logging import logging
from mastodon import Mastodon, MastodonServerError import mastodon
import re import re
from report import Report from report import Report
@ -19,13 +19,13 @@ class MastodonBot(Bot):
""" """
mentions = [] mentions = []
try: try:
m = Mastodon(*user.get_masto_credentials()) m = mastodon.Mastodon(*user.get_masto_credentials())
except TypeError: except TypeError:
# logger.error("No Mastodon Credentials in database.", exc_info=True) # logger.error("No Mastodon Credentials in database.", exc_info=True)
return mentions return mentions
try: try:
notifications = m.notifications() notifications = m.notifications()
except MastodonServerError: except mastodon.MastodonServerError:
logger.error("Unknown Mastodon API Error: 502") logger.error("Unknown Mastodon API Error: 502")
return mentions return mentions
for status in notifications: for status in notifications:
@ -54,7 +54,7 @@ class MastodonBot(Bot):
def post(self, user, report): def post(self, user, report):
try: try:
m = Mastodon(*user.get_masto_credentials()) m = mastodon.Mastodon(*user.get_masto_credentials())
except TypeError: except TypeError:
return # no mastodon account for this user. return # no mastodon account for this user.
if report.source == self: if report.source == self: