From 2f33d840f36f037e4a9bafeb951343cfc72e8737 Mon Sep 17 00:00:00 2001 From: official-Cromatin Date: Sun, 21 Sep 2025 14:59:12 +0200 Subject: [PATCH] Move version to independent VERSION file --- src/VERSION | 1 + src/cogs/debug.py | 2 +- src/const.py | 8 ++++++++ src/main.py | 5 ++++- src/utils/portal.py | 1 - 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 src/VERSION create mode 100644 src/const.py diff --git a/src/VERSION b/src/VERSION new file mode 100644 index 0000000..2411653 --- /dev/null +++ b/src/VERSION @@ -0,0 +1 @@ +0.5.2 \ No newline at end of file diff --git a/src/cogs/debug.py b/src/cogs/debug.py index 64f67d1..a67a0a6 100644 --- a/src/cogs/debug.py +++ b/src/cogs/debug.py @@ -21,7 +21,7 @@ class Debug_Command(Base_Cog): embed = discord.Embed(title="Debug Information") embed.add_field(name="Version", - value=f"`{portal.PROGRAM_VERSION}`", + value=ctx.client.VERSION, inline=True) embed.add_field(name="Uptime", value=f"{get_elapsed_time_big(datetime.now().timestamp() - portal.STARTUP_TIMESTAMP)}", diff --git a/src/const.py b/src/const.py new file mode 100644 index 0000000..1520a09 --- /dev/null +++ b/src/const.py @@ -0,0 +1,8 @@ +from pathlib import Path + +# Read VERSION file +with open(Path(__file__).resolve().parent / "VERSION") as f: + VERSION = f.read().strip() + + +__all__ = VERSION diff --git a/src/main.py b/src/main.py index 16f2d96..1a6d000 100644 --- a/src/main.py +++ b/src/main.py @@ -13,12 +13,13 @@ from utils.portal import Portal import asyncio from typing import Union from platforms.reddit import Reddit_Adapter +from const import VERSION print(" ____ ____ ___________ __________") print(" / __ \/ __ \/ ___/_ __/ / _/_ __/") print(" / /_/ / / / /\__ \ / /_____ / / / / ") print(" / ____/ /_/ /___/ // /_____// / / / ") -print(" /_/ \____//____//_/ /___/ /_/ ") +print(f" /_/ \____//____//_/ /___/ /_/ v{VERSION}") print(" Copyright (c) 2024-2025 Lars Winzer") print() print(" Source: https://github.com/official-Cromatin/Post-It") @@ -44,6 +45,8 @@ class MyBot(commands.Bot): self.__portal:Portal self.__first_on_ready = False + self.VERSION = VERSION + def set_portal(self, portal:Portal): self.__portal = portal diff --git a/src/utils/portal.py b/src/utils/portal.py index e67701f..9a778e4 100644 --- a/src/utils/portal.py +++ b/src/utils/portal.py @@ -4,7 +4,6 @@ from platforms.reddit import Reddit_Adapter @Singleton class Portal: - PROGRAM_VERSION = "0.3" bot_config:Advanced_ConfigParser = None platforms_config:Advanced_ConfigParser = None STARTUP_TIMESTAMP:float = None