return json from the db request

This commit is contained in:
deflax 2024-01-16 18:42:23 +02:00
parent 5662f0eca3
commit deea320d98

View file

@ -41,16 +41,19 @@ async def epg(ctx):
if requests.get(db_url).status_code == 200: if requests.get(db_url).status_code == 200:
response = requests.get(db_url) response = requests.get(db_url)
response.raise_for_status() response.raise_for_status()
content = response.text content = response.json
await ctx.channel.send(type(content)) await ctx.channel.send('epg:')
for item in content: if content != {}:
if item['start_at'] == 'now' or item['start_at'] == 'never': for item in content:
await ctx.channel.send('x') if item['start_at'] == 'now' or item['start_at'] == 'never':
continue await ctx.channel.send('x')
else: continue
await ctx.channel.send('y') else:
await ctx.channel.send(item['start_at']) await ctx.channel.send('x')
await ctx.channel.send(item['start_at'])
else:
await ctx.channel.send('Empty database!')
except Exception as e: except Exception as e:
print(e) print(e)