From 0d1757f4c86ba4e0ad841692edbdba0759d9b9b6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 31 Jul 2020 16:11:08 +0200 Subject: [PATCH] Fix royalpackversion.py not printing the version --- royalpack/commands/royalpackversion.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/royalpack/commands/royalpackversion.py b/royalpack/commands/royalpackversion.py index f2b17584..5795e287 100644 --- a/royalpack/commands/royalpackversion.py +++ b/royalpack/commands/royalpackversion.py @@ -1,5 +1,6 @@ from typing import * +import functools import pkg_resources import royalnet.commands as rc @@ -12,14 +13,16 @@ class RoyalpackCommand(rc.Command): syntax: str = "" @property - def royalpack_version(self): + @functools.lru_cache(1) + def royalpack_version(self) -> str: return pkg_resources.get_distribution("royalpack").version async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None: + # noinspection PyUnreachableCode if __debug__: message = f"ℹ️ Royalpack [url=https://github.com/Steffo99/royalpack/]Unreleased[/url]\n" else: message = f"ℹ️ Royalpack [url=https://github.com/Steffo99/royalpack/releases/tag/{self.royalpack_version}]{self.royalpack_version}[/url]\n" - if "69" in semantic: + if "69" in self.royalpack_version: message += "(Nice.)" await data.reply(message)