#What does this error mean, why its happening?

1 messages · Page 1 of 1 (latest)

lethal stratus
#

Hey, Im trying run one bot, Im getting this error:

Ignoring exception in slash command 'channel': Traceback (most recent call last): File "/home/jst/BakaBot/env/lib/python3.12/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1378, in process_application_commands await app_command.invoke(interaction) File "/home/jst/BakaBot/env/lib/python3.12/site-packages/disnake/ext/commands/slash_core.py", line 717, in invoke await self.prepare(inter) File "/home/jst/BakaBot/env/lib/python3.12/site-packages/disnake/ext/commands/base_core.py", line 315, in prepare raise CheckFailure(f"The check functions for command {self.qualified_name!r} failed.") disnake.ext.commands.errors.CheckFailure: The check functions for command 'channel' failed.

My code for that command that makes error:
`
channels = ["Grades", "Schedule", "Reminder", "Status"]

async def channelSchedule(self, inter: disnake.ApplicationCommandInteraction, function: str):
    write_db(f"channel{function}", inter.channel_id)
    await inter.response.send_message(f"channel_{function.lower()} changed to this channel", ephemeral=True)

slashChannelSchedule = commands.InvokableSlashCommand(
    channelSchedule,
    name="channel",
    description="Use this command in the channel where you want to have the bot's functions to send messages",
    checks=[admin_user_check],
    group=group,
    options=[
        disnake.Option(
            name="function",
            description="Select the function for this channel",
            choices=[disnake.OptionChoice(name=channel, value=channel) for channel in channels],
            type=disnake.OptionType.string,
            required=True,
        ),
    ],
)

`

The Bot has admin permission.

#

What does this error mean, why its happening?

pastel pebble
#

Your check function failed, you need to identify what's going wrong with the check function

tiny mesa
#

Also, although this isn't directly related to your issue, that's not how you add slash commands. Use the decorator:

@commands.slash_command(options_here)
async def command(params_here):
    # ...
lethal stratus
lethal stratus
pastel pebble
#

It is your own check function...
checks=[admin_user_check]

tiny mesa
lethal stratus
#

Okay, thanks guys for help