commit
7712d27d1b
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from bot import Bot
|
from bot import Bot
|
||||||
import logging
|
import logging
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon, MastodonServerError
|
||||||
import re
|
import re
|
||||||
from report import Report
|
from report import Report
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ class MastodonBot(Bot):
|
||||||
return mentions
|
return mentions
|
||||||
try:
|
try:
|
||||||
notifications = m.notifications()
|
notifications = m.notifications()
|
||||||
except Exception:
|
except MastodonServerError:
|
||||||
logger.error("Unknown Mastodon API Error.", exc_info=True)
|
logger.error("Unknown Mastodon API Error: 502")
|
||||||
return mentions
|
return mentions
|
||||||
for status in notifications:
|
for status in notifications:
|
||||||
if (status['type'] == 'mention' and
|
if (status['type'] == 'mention' and
|
||||||
|
|
|
@ -32,6 +32,12 @@ class TelegramBot(Bot):
|
||||||
logger.error("Unknown Telegram error code: " + str(update))
|
logger.error("Unknown Telegram error code: " + str(update))
|
||||||
return reports
|
return reports
|
||||||
user.save_seen_tg(update.update_id)
|
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":
|
if update.message.text.lower() == "/start":
|
||||||
user.add_telegram_subscribers(update.message.sender.id)
|
user.add_telegram_subscribers(update.message.sender.id)
|
||||||
tb.send_message(
|
tb.send_message(
|
||||||
|
|
|
@ -73,7 +73,7 @@ class TwitterBot(Bot):
|
||||||
def post(self, user, report):
|
def post(self, user, report):
|
||||||
try:
|
try:
|
||||||
api = self.get_api(user)
|
api = self.get_api(user)
|
||||||
except IndexError:
|
except TypeError:
|
||||||
return # no twitter account for this user.
|
return # no twitter account for this user.
|
||||||
try:
|
try:
|
||||||
if report.source == self:
|
if report.source == self:
|
||||||
|
|
Loading…
Reference in a new issue