-
Notifications
You must be signed in to change notification settings - Fork 185
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug.
Taken from #AttributeError 'NoneType' object has no attribute 'name' in the help forum
In the on_command event, there is a possibility that ctx.command is None instead of the associated Command instance. This is due to a race condition where some attribute processing for Context is done when the command is being invoked. This issue likely applies to other attributes as well, though that has not been tested yet
A workaround is to call asyncio.sleep with a short delay, but users likely won't find that solution on their own
List the steps.
Set up the client with a command and a listener for the on_command event. In the event, access ctx.command
What you expected.
ctx.command to be a Command instance
What you saw.
ctx.command is None
What version of the library did you use?
release
Version specification
4.3.2
Code of Conduct
- I agree to follow the contribution requirements.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working