add channel used in info command + improve regex

This commit is contained in:
Mylloon 2021-07-28 22:13:58 +02:00
parent 6a9d5f9d25
commit 0c0d26a324
2 changed files with 7 additions and 3 deletions

View file

@ -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:

View file

@ -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"""