#Regex doesn't support for thai language again

1 messages · Page 1 of 1 (latest)

random edge
#

i have got error as last time
discord.errors.ExtensionFailed: Extension 'scripts.general' raised an error: TypeError: Command names and options must be of type str. Received "โปรไฟล์" in l
ocale th

#

well there is an error in th lang again

#

in discord/commands/core.py line 1637 - 1660

#

@upper glacier

#

Can you discuss abt this error again?

crude kettle
#

The regex in the code matches those charecters... Let me do some more looking

crude kettle
#

Can you post a full traceback?

random edge
#

Okay

#
Traceback (most recent call last):
  File "C:\Users\ACER\RaidenShogun\bot.py", line 24, in <module>
    RaidenBotClass.start()
  File "C:\Users\ACER\RaidenShogun\bot.py", line 15, in start
    bot.load_extension(f"scripts.{filename[:-3]}")
  File "C:\Users\ACER\RaidenShogun\venv\lib\site-packages\discord\cog.py", line 787, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\ACER\RaidenShogun\venv\lib\site-packages\discord\cog.py", line 718, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'scripts.general' raised an error: TypeError: Command names and options must be of type str. Received "โปรไฟล์" in l
ocale th```
crude kettle
#

So it is a bug. I will mention it

wispy sinewBOT
#

discord/commands/core.py line 1644

if not isinstance(name, str) or not re.match(r"^[\w-]{1,32}$", name):```
random edge
#

this bug is the second time now.

#

@upper glacier have fixed this pr before

crude kettle
#

What it looks like to me is that IlluminatiFish fixed it right before permissions V2 was released and they did a bad job at the merge conflicts.

random edge
#

Maybe this part must remove

if not isinstance(name, str) or not re.match(r"^[\w-]{1,32}$", name):
        error = TypeError(f'Command names and options must be of type str. Received "{name}"')```
crude kettle
#

The regex part needs to be updated or removed

I cant pin who added that line though. Im not sure why the regex is needed there.

random edge
#

cuz i have comment this part then the bot works as expected

crude kettle
#

Ok, still trying to find who made that change so I can ask them why.

random edge
#

Pull request :
Update validation regex for command names & options
From :

if not isinstance(name, str) or not re.match(r"^[\w-]{1,32}$", name):
        error = TypeError(f'Command names and options must be of type str. Received "{name}"')

To :

if not isinstance(name, str):
        error = TypeError(f'Command names and options must be of type str. Received "{name}"')
crude kettle
#

Yeah to me that makes sense.

random edge
crude kettle
#

It shouldn't have to match regex to determine if it is a string becouse regex only works on strings lol

#

I'm unable to make an issue or PR right now. Will you do this or should I later

random edge
#

oh nvm i will pull request that

crude kettle
#

Ok.

sharp sedge
#

a fix was already pushed for this?

#

##1309

wispy sinewBOT
sharp sedge
#

are you sure you're on the right version?

#

this should be bundled in with RC1

crude kettle
#

Is rc1 ahead of master. That code is in master

sharp sedge
#

rc1 was released yesterday and that pr was merged about 2 weeks ago

random edge
#

i'm in py-cord 2.0.0rc1

crude kettle
#

The PR that fixed it got overwritten. I think someone did a bad job at merge conflicts as something was added just a day later thay made it break

random edge
crude kettle
#

I can do it in a few hours if you cant

random edge
#

okay my internet stable rn

warped comet
#

oh it was perms v2

sharp sedge
#

if nobody else does I can open a PR later tonight

sharp sedge
#

##1372 is open to fix this

wispy sinewBOT
random edge
upper glacier
sharp sedge
#

when they merged perms v2 it ended up rolling back your pr

upper glacier
#

stonks.

#

thought so

#

also I couldn't reply during May as I was away on vacation just got back a few days ago and realised I had pings in here