From 593877441fab007b60aad985d13e8a794386a7de Mon Sep 17 00:00:00 2001 From: deflax Date: Mon, 15 Jan 2024 04:45:31 +0200 Subject: [PATCH] define example bot --- src/discordbot/app.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/discordbot/app.py diff --git a/src/discordbot/app.py b/src/discordbot/app.py new file mode 100644 index 0000000..9550169 --- /dev/null +++ b/src/discordbot/app.py @@ -0,0 +1,23 @@ +import os +import discord +from discord.ext import commands + +# Read env variables +bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token') +scheduler_hostname = os.environ.get('SCHEDULER_API_HOSTNAME', 'tv.example.com') + +# Create a bot instance with a command prefix +bot = commands.Bot(command_prefix='!') + +# Define a simple command +@bot.command(name='about', help='Displays about info') +async def hello(ctx): + await ctx.send(f'Hello {ctx.author.name}! ') + +# Define an event when the bot is ready +@bot.event +async def on_ready(): + print(f'Logged in as {bot.user.name}') + +# Run the bot with your bot token +bot.run(bot_token) \ No newline at end of file