Can't retrieve url from TypedCommand
Posted: Thu Aug 12, 2021 6:21 pm
When i use TypedSayCommand i cant validate a url param because the function only receives the string until the // part

i found my way around this with python but am i doing something wrong with the TypedSayCommand?

Code: Select all
class Validator:
@staticmethod
def valid_url(value):
regex = r"[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)"
print(value) # prints "https"
is_valid = re.search(regex, value)
if not is_valid:
raise ValidationError("Url inválida")
return True
@TypedSayCommand('!trails')
def on_trails(command_info, name:str, url:Validator.valid_url):
pass
#print(name)
#print(url)
i found my way around this with python but am i doing something wrong with the TypedSayCommand?