Fix !uptime when not streaming
This commit is contained in:
parent
3644a5b8fc
commit
6ee4331129
6
bot.py
6
bot.py
|
|
@ -131,7 +131,11 @@ class UptimeResponse(Response):
|
|||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url, headers=headers) as response:
|
||||
text = await response.text()
|
||||
start_time_s = json.loads(text)['data'][0]['started_at']
|
||||
data = json.loads(text)['data']
|
||||
if not data:
|
||||
msg = 'not currently streaming!'
|
||||
return PRIVMSG.format(channel=config.channel, msg=msg)
|
||||
start_time_s = data[0]['started_at']
|
||||
start_time = datetime.datetime.strptime(
|
||||
start_time_s, '%Y-%m-%dT%H:%M:%SZ',
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue