Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to make a withdraw command in by economy bot, but python won't let me use "with" as the name. I think the reason why is that with is a built in python function. Can someone tell me how I can make "with" the command name in async def with(ctx, amount=None):?

Code:

@client.command()
async def with(ctx, amount = None):

Error:

  File "main.py", line 363
    async def with(ctx, amount = None):
              ^
SyntaxError: invalid syntax

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

with is a reserved keyword in Python. Override the command name like

@client.command(name='with')
async def _with(ctx, amount = None):

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...