From eda0edb92a5bb9411fdc7b6789e565d1bfecfb35 Mon Sep 17 00:00:00 2001 From: adator85 <> Date: Sat, 17 Aug 2024 13:46:24 +0200 Subject: [PATCH] Adding a method to test a channel --- core/base.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/base.py b/core/base.py index c8a1092..53efbe2 100644 --- a/core/base.py +++ b/core/base.py @@ -509,8 +509,34 @@ class Base: self.periodic_func.clear() def clean_uid(self, uid:str) -> str: + """Clean UID by removing @ / % / + / Owner / and * + + Args: + uid (str): The UID to clean + + Returns: + str: Clean UID without any sign + """ pattern = fr'[@|%|\+|~|\*]*' parsed_UID = re.sub(pattern, '', uid) - return parsed_UID \ No newline at end of file + return parsed_UID + + def Is_Channel(self, channelToCheck: str) -> bool: + """Check if the string has the # caractere and return True if this is a channel + + Args: + channelToCheck (str): The string to test if it is a channel or not + + Returns: + bool: True if the string is a channel / False if this is not a channel + """ + + pattern = fr'^#' + isChannel = re.findall(pattern, channelToCheck) + + if not isChannel: + return False + else: + return True \ No newline at end of file