diff --git a/modules/twitter.py b/modules/twitter.py
index a21c4f7..41f71ca 100644
--- a/modules/twitter.py
+++ b/modules/twitter.py
@@ -7,7 +7,12 @@ class MatrixModule(PollingService):
service_name = 'Twitter'
async def poll_implementation(self, bot, account, roomid, send_messages):
- for tweet in query_tweets_from_user("twitter", limit=1):
- if tweet.tweet_id not in self.known_ids:
- await bot.send_html(bot.get_room_by_id(roomid), f'Twitter {account}: {tweet.text}', f'Twitter {account}: {tweet.text} - https://twitter.com{tweet.tweet_url}')
- self.known_ids.add(tweet.tweet_id)
+ try:
+ for tweet in query_tweets_from_user(account, limit=1):
+ if tweet.tweet_id not in self.known_ids:
+ if send_messages:
+ await bot.send_html(bot.get_room_by_id(roomid), f'Twitter {account}: {tweet.text}', f'Twitter {account}: {tweet.text} - https://twitter.com{tweet.tweet_url}')
+ self.known_ids.add(tweet.tweet_id)
+ except Exception:
+ print('Polling twitter account failed:')
+ traceback.print_exc(file=sys.stderr)