Compare commits
8 commits
refactorin
...
master
Author | SHA1 | Date | |
---|---|---|---|
b3yond | 8c778927ee | ||
b3yond | 079166e74c | ||
b3yond | fb15771cf2 | ||
d1b11fe932 | |||
b3yond | c30f9d8eaa | ||
b3yond | 7a7e8f0a30 | ||
b3yond | e18244e149 | ||
b3yond | cd3c8be2dc |
|
@ -2,7 +2,7 @@
|
|||
|
||||
from bot import Bot
|
||||
import logging
|
||||
from mastodon import Mastodon
|
||||
import mastodon
|
||||
import re
|
||||
from report import Report
|
||||
|
||||
|
@ -19,14 +19,14 @@ class MastodonBot(Bot):
|
|||
"""
|
||||
mentions = []
|
||||
try:
|
||||
m = Mastodon(*user.get_masto_credentials())
|
||||
m = mastodon.Mastodon(*user.get_masto_credentials())
|
||||
except TypeError:
|
||||
# logger.error("No Mastodon Credentials in database.", exc_info=True)
|
||||
return mentions
|
||||
try:
|
||||
notifications = m.notifications()
|
||||
except Exception:
|
||||
logger.error("Unknown Mastodon API Error.", exc_info=True)
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Unknown Mastodon API Error: 502")
|
||||
return mentions
|
||||
for status in notifications:
|
||||
if (status['type'] == 'mention' and
|
||||
|
@ -54,7 +54,7 @@ class MastodonBot(Bot):
|
|||
|
||||
def post(self, user, report):
|
||||
try:
|
||||
m = Mastodon(*user.get_masto_credentials())
|
||||
m = mastodon.Mastodon(*user.get_masto_credentials())
|
||||
except TypeError:
|
||||
return # no mastodon account for this user.
|
||||
if report.source == self:
|
||||
|
|
|
@ -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 as text instead?")
|
||||
continue
|
||||
if update.message.text.lower() == "/start":
|
||||
user.add_telegram_subscribers(update.message.sender.id)
|
||||
tb.send_message(
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue