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

Removing commands on bot load #2888

Closed
Stonedestroyer opened this issue Jul 18, 2019 · 0 comments · Fixed by #2889
Closed

Removing commands on bot load #2888

Stonedestroyer opened this issue Jul 18, 2019 · 0 comments · Fixed by #2889

Comments

@Stonedestroyer
Copy link
Contributor

@Stonedestroyer Stonedestroyer commented Jul 18, 2019

Other bugs

Loading a cog with bot.remove_command statements in init causes it to error out and not load.

What were you trying to do?

I have a cog that has statements in init like this

        bot.remove_command("invite")
        bot.remove_command("ping")
        bot.remove_command("pong")
        bot.remove_command("uptime")

What were you expecting to happen?

The commands to be unloaded and my command loaded.

What actually happened?

The cog does not load.

Traceback (most recent call last):
File "/data/venv/lib/python3.7/site-packages/redbot/core/events.py", line 71, in on_ready
await bot.load_extension(spec)
File "/data/venv/lib/python3.7/site-packages/redbot/core/bot.py", line 304, in load_extension
lib.setup(self)
File "/data/cogs/CogManager/cogs/general/__init__.py", line 5, in setup
bot.add_cog(General(bot))
File "/data/cogs/CogManager/cogs/general/general.py", line 39, in __init__
bot.remove_command("pong")
File "/data/venv/lib/python3.7/site-packages/redbot/core/bot.py", line 466, in remove_command
command.requires.reset()
AttributeError: 'NoneType' object has no attribute 'requires'

How can we reproduce this issue?

Make a simple cog with this in init
bot.remove_command("ping")

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 a pull request may close this issue.

1 participant