Skip to content

Commit

Permalink
Add version command with the build time
Browse files Browse the repository at this point in the history
  • Loading branch information
nfaltermeier committed Apr 28, 2022
1 parent bf5a058 commit ed34da2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ RUN pip3 --no-cache-dir install -U py-cord==2.0.0b5 python-dotenv

COPY .env src/ secret-scholars-bot-config.json ./

RUN printf "build_time=%s" "'`date -Iseconds`'" > autogen_buildtime.py

CMD [ "python", "./bot.py" ]
2 changes: 2 additions & 0 deletions Dockerfile-arm32v6
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ RUN pip3 --no-cache-dir install -U py-cord==2.0.0b5 python-dotenv

COPY .env src/ secret-scholars-bot-config.json ./

RUN printf "build_time=%s" "'`date -Iseconds`'" > autogen_buildtime.py

CMD [ "python", "./bot.py" ]
8 changes: 7 additions & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import asyncio
import minecraft
import excuse
import autogen_buildtime

logging.basicConfig(level=logging.INFO)

Expand Down Expand Up @@ -49,7 +50,12 @@ async def on_message(message):
if await roll.on_message(message):
return

if message.content.startswith('$hello'):
if message.content.startswith('$version'):
time = datetime.fromisoformat(autogen_buildtime.build_time)
await message.channel.send(f'Build time: {time.strftime("%b %d %Y %X %Z")}', delete_after=300)
await asyncio.sleep(300)
await message.delete()
elif message.content.startswith('$hello'):
await message.channel.send('Hello!', delete_after=300)
await asyncio.sleep(300)
await message.delete()
Expand Down

0 comments on commit ed34da2

Please sign in to comment.