async def on_message(message):
content = message.content.lower() # The actual content of the message in lowercase
pattern = "imagine having a name as dumb as (.{0,32})" # Max length for nicks is 32 characters
if (nick := re.findall(pattern, content): # Walrus operator, need python 3.8+
await message.author.edit(nick=nick[0]) # Editing the actual nick
我得到这个错误:
File "main.py", line 75
if (nick := re.findall(pattern, content):
^
SyntaxError: invalid syntax
我该如何修复它?
您缺少一个正在关闭的Paradishesion
if (nick := re.findall(pattern, content)):