logging & avatar fix

This commit is contained in:
Tomáš Mládek 2021-02-26 22:34:03 +01:00
parent d2b740f21d
commit 808156f016

4
bot.py
View file

@ -60,7 +60,7 @@ async def send_message(text):
"text": text,
"format": "html",
"displayName": "PUBLIC INFORMATION STREAMS & SERVICES",
"avatarUrl": "http://i.imgur.com/IDOBtEJ.png"
"avatarUrl": config.AVATAR_URL
})
@ -84,10 +84,12 @@ async def main():
for event in future_events:
if event.name not in state.notified and event.begin.shift(days=-2) < arrow.now():
logging.info(f"Sending description of {event.name}")
await send_message(process_event(event, config.EVENT_TEMPLATE))
state.notified.append(event.name)
if event.name not in state.notified_soon and event.begin.shift(hours=-2) < arrow.now():
logging.info(f"Notifying of {event.name}")
await send_message(process_event(event, config.SOON_TEMPLATE))
state.notified_soon.append(event.name)