I'm trying to make a command that can disable and enable any of my current commands. But it keeps returning the following error:
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'nextcord.ext.commands' has no attribute 'get'
This is my current code for that command:
@commands.command()
@commands.has_role("HR")
async def toggle(self, ctx, *, command):
command = commands.get.command(command)
role = nextcord.utils.get(ctx.guild.roles, name="owner")
if ctx.command == command:
await ctx.reply("nice try")
else:
command.enabled = not command.enabled
tf = "enabled" if command.enabled else "disabled"
await ctx.send(f"I have {tf} {command.qualified_name} for you!")
It's just a typo. The function's name is
get_command
. You might also wanna use@commands.is_owner()
so that only the owner of the bot can disable commands instead of a guild role but its up to you. Also it seems like this is in a cog so you should useself.client
orself.bot
depending on what you have in your__init__()
.