Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[commands] Correct command removing during cog injecting #5804

Merged
merged 1 commit into from Sep 9, 2020

Conversation

Phxntxm
Copy link
Contributor

@Phxntxm Phxntxm commented Sep 9, 2020

Summary

bot.remove_command takes a string, however the command object was attempting to be passed during the handling of errors when injecting during bot.add_cog.

Since commands are removed during loading of extensions this doesn't actually cause an issue in most use cases, since extensions and cogs typically go hand in hand. However in the specific use case of using case insensitive commands, when it tries to pop the name it tries to run casefold, expecting the key to be a string. This fails on this situation, and you end up with an unhelpful error message of AttributeError: 'Command' object has no attribute 'casefold'. This PR fixes that

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Rapptz Rapptz added this to the 1.5 milestone Sep 9, 2020
@Rapptz Rapptz merged commit 7acec50 into Rapptz:master Sep 9, 2020
@Phxntxm Phxntxm deleted the casefold branch April 10, 2021 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants