Skip to content

Commit

Permalink
feat(discord): add version info (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Aug 30, 2024
1 parent ea30681 commit f752d97
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
23 changes: 21 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
# artifacts: false
# platforms: linux/amd64
FROM python:3.12-slim-bookworm

# CI args
ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
# note: BUILD_VERSION may be blank

ENV BRANCH=${BRANCH}
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}

# Basic config
ARG DAILY_TASKS=true
ARG DAILY_RELEASES=true
Expand Down Expand Up @@ -54,6 +64,15 @@ VOLUME /data
WORKDIR /app/

COPY . .
RUN python -m pip install --no-cache-dir -r requirements.txt
RUN <<_SETUP
#!/bin/bash
set -e

# replace the version in the code
sed -i "s/version = '0.0.0'/version = '${BUILD_VERSION}'/g" src/common.py

# install dependencies
python -m pip install --no-cache-dir -r requirements.txt
_SETUP

CMD ["python", "-m", "src"]
2 changes: 1 addition & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def main():
reddit_bot.stop()


if __name__ == '__main__':
if __name__ == '__main__': # pragma: no cover
main()
1 change: 1 addition & 0 deletions src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ def get_data_dir():
bot_name = f'{org_name}-Bot'
bot_url = 'https://app.lizardbyte.dev'
data_dir = get_data_dir()
version = '0.0.0'
4 changes: 3 additions & 1 deletion src/discord/cogs/base_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from discord.commands import Option

# local imports
from src.common import avatar, bot_name, org_name
from src.common import avatar, bot_name, org_name, version
from src.discord.views import DonateCommandView
from src.discord import cogs_common

Expand Down Expand Up @@ -37,6 +37,8 @@ async def help_command(
else:
description += await self.get_command_help(ctx=ctx, cmd=cmd)

description += f"\n\nVersion: {version}\n"

embed = discord.Embed(description=description, color=0xE5A00D)
embed.set_footer(text=bot_name, icon_url=avatar)

Expand Down

0 comments on commit f752d97

Please sign in to comment.