ig: survive exceptions by ig library - fixes #10. loc: allow multi-word search strings
This commit is contained in:
parent
325e1e623c
commit
d8d38415d1
|
@ -1,3 +1,5 @@
|
|||
import traceback
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
from random import randrange
|
||||
|
||||
|
@ -34,11 +36,13 @@ class MatrixModule:
|
|||
' account that does not exist - deleting from room')
|
||||
self.account_rooms[roomid].remove(account)
|
||||
bot.save_settings()
|
||||
except Exception:
|
||||
print('Polling instagram account failed:')
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
|
||||
self.first_run = False
|
||||
|
||||
async def poll_account(self, bot, account, roomid, send_messages):
|
||||
print('polling', account, roomid, send_messages)
|
||||
medias = self.instagram.get_medias(account, 5)
|
||||
|
||||
for media in medias:
|
||||
|
|
|
@ -41,10 +41,12 @@ class MatrixModule:
|
|||
args.pop(0)
|
||||
if len(args) == 0:
|
||||
await bot.send_text(room, 'Usage: !loc <location name>')
|
||||
if len(args) == 1:
|
||||
else:
|
||||
query = event.body[4:]
|
||||
geolocator = Nominatim(user_agent=bot.appid)
|
||||
print('loc: looking up', query, '..')
|
||||
location = geolocator.geocode(query)
|
||||
print('loc rx', location)
|
||||
if location:
|
||||
locationmsg = {
|
||||
"body": str(location.address),
|
||||
|
|
Loading…
Reference in New Issue