print database

This commit is contained in:
deflax 2024-01-16 05:32:57 +02:00
parent 6917f489d3
commit bc96b28091

View file

@ -1,5 +1,6 @@
import os
import discord
import requests
# Read env variables
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
@ -19,6 +20,18 @@ async def on_ready():
async def hello(message):
await message.channel.send('Hello!')
async def epg(message):
try:
db_url = f'https://{scheduler_hostname}/database'
if requests.get(db_url).status_code == 200:
response = requests.get(db_url)
response.raise_for_status()
content = response.text
await message.channel.send(content)
except Exception as e:
print(e)
@client.event
async def on_message(message):
if message.author == client.user:
@ -26,5 +39,8 @@ async def on_message(message):
if message.content.startswith('!hello'):
await hello(message)
if message.content.startswith('!epg'):
await epg(message)
client.run(bot_token)