From 9f7183e955fc5c41243ceb02a28fa6e2e2f84488 Mon Sep 17 00:00:00 2001 From: cisco Date: Tue, 3 Jan 2023 22:40:31 +0100 Subject: [PATCH] defined docker file and added demo test script --- Dockerfile | 6 ++++++ example_bot.py | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Dockerfile create mode 100644 example_bot.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..42d19f7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.10 +# Or any preferred Python version. +ADD example_bot.py . +RUN pip install discord.py +CMD [“python”, “./example_bot.py”] +# Or enter the name of your unique directory and parameter set. \ No newline at end of file diff --git a/example_bot.py b/example_bot.py new file mode 100644 index 0000000..f47c03a --- /dev/null +++ b/example_bot.py @@ -0,0 +1,23 @@ +# This example requires the 'message_content' intent. + +import discord +import os + +intents = discord.Intents.default() +intents.message_content = True + +client = discord.Client(intents=intents) + +@client.event +async def on_ready(): + print(f'We have logged in as {client.user}') + +@client.event +async def on_message(message): + if message.author == client.user: + return + + if message.content.startswith('$hello'): + await message.channel.send('Hello cisco!') + +client.run(os.getenv('TOKEN')) \ No newline at end of file