From 0c0d26a324683dc9c6610fa3d0a4f62470b32c3b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 28 Jul 2021 22:13:58 +0200 Subject: [PATCH] add channel used in info command + improve regex --- src/cogs/utils.py | 4 ++-- src/utils/core.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cogs/utils.py b/src/cogs/utils.py index 3c04fdf..c875c3c 100644 --- a/src/cogs/utils.py +++ b/src/cogs/utils.py @@ -4,7 +4,7 @@ from random import randint, shuffle from discord_slash import cog_ext from utils.reminder import Reminder from utils.core import map_list_among_us, getURLsInString, getMentionInString, cleanCodeStringWithMentionAndURLs, cleanUser, userOrNick -from utils.core import mySendHidden, mentionToUser, getChangelogs, getActualVersion, isSlash, load +from utils.core import mySendHidden, mentionToUser, getChangelogs, getActualVersion, isSlash, load, devOrStableChannel from utils.time import stringTempsVersSecondes, nowUTC, intToDatetime, timedeltaToString, timestampScreen, getAge, ageLayout, nowCustom def setup(client): @@ -249,7 +249,7 @@ class Utils(commands.Cog): version = f"`{version}`" if changes[0] == 200: version = f"[{version}]({changes[1]})" - embed.add_field(name = "Version", value = version) + embed.add_field(name = "Version", value = f"{version} ({devOrStableChannel()})") embed.set_footer(text = f"Basé sur discord.py {discord.__version__}") try: if fromSlash != True: diff --git a/src/utils/core.py b/src/utils/core.py index 38617e5..84f0d08 100644 --- a/src/utils/core.py +++ b/src/utils/core.py @@ -132,7 +132,11 @@ def getChangelogs(version = 'actual'): def getActualVersion(): with open(path.join(path.dirname(path.dirname(path.dirname(__file__))), "README.md"), "r") as file: - return findall(r'https://img.shields.io/badge/version-(\d+\.\d+)', file.readlines()[2])[0] + return findall(r'https:\/\/img.shields.io\/badge\/version-(\d+\.\d+)-green\?style=for-the-badge\)', file.readlines()[2])[0] + +def devOrStableChannel(): + with open(path.join(path.dirname(path.dirname(path.dirname(__file__))), "README.md"), "r") as file: + return findall(r'https:\/\/img.shields.io\/gitlab\/pipeline\/ConfrerieDuKassoulait\/KassouBot\/([a-z]+)\?style=for-the-badge\)]', file.readlines()[3])[0] def isSlash(arg): """Regarde si la commande viens d'un slash ou pas, retourne l'argument sans le 'True' si c'est le cas"""