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:
response = requests.get(db_url)
response.raise_for_status()
content = response.text
await ctx.channel.send(type(content))
content = response.json
await ctx.channel.send('epg:')
for item in content:
if item['start_at'] == 'now' or item['start_at'] == 'never':
await ctx.channel.send('x')
continue
else:
await ctx.channel.send('y')
await ctx.channel.send(item['start_at'])
if content != {}:
for item in content:
if item['start_at'] == 'now' or item['start_at'] == 'never':
await ctx.channel.send('x')
continue
else:
await ctx.channel.send('x')
await ctx.channel.send(item['start_at'])
else:
await ctx.channel.send('Empty database!')
except Exception as e:
print(e)