'Nextcord: I have a custom slash command and it won't run because the console says I'm missing access. How do I fix that?

Refer to this code for the command,

client = commands.Bot(command_prefix='!', intents=intents, allowed_mentions=nextcord.AllowedMentions(everyone=True))

# Test Command
@client.slash_command(name= 'test_bot', description='Checks the operational state of the client.', guild_ids=[806043206030589952])
async def test(interaction:Interaction):
  bot_log = channel_up(940125176723554394)
  await bot_log.send(f'<@&806045254834847776>, {interaction.user.mention} has started diagnostics for the bot. Please ignore any possible disturbances for the next minute or so.')

I'm having the error where I'm missing access

Traceback (most recent call last):
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/client.py", line 415, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/client.py", line 1741, in on_interaction
    await self.process_application_commands(interaction)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/client.py", line 1757, in process_application_commands
    await app_cmd.call_from_interaction(interaction)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/application_command.py", line 1173, in call_from_interaction
    await self.call(self._state, interaction, interaction.data.get("options", {}))
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/application_command.py", line 1177, in call
    await super().call(state, interaction, option_data)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/application_command.py", line 656, in call
    await self.call_invoke_slash(state, interaction, option_data)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/application_command.py", line 697, in call_invoke_slash
    await self.invoke_slash(interaction, **kwargs)
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/application_command.py", line 714, in invoke_slash
    await self.callback(interaction, **kwargs)
  File "main.py", line 62, in test
    await bot_log.send(f'<@&806045254834847776>, {interaction.user.mention} has started diagnostics for the bot. Please ignore any possible disturbances for the next minute or so.')
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/abc.py", line 1418, in send
    data = await state.http.send_message(
  File "/home/runner/ClanbotAPI/venv/lib/python3.8/site-packages/nextcord/http.py", line 331, in request
    raise Forbidden(response, data)
nextcord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access

and I don't know why. I have application commands turned on for the slash commands if that helps. And made sure my bot can view the channel the message should send to.

I'm also having the issue where my other commands won't show up when the have the same slash command decorator. If anyone has insight into this, that'd be very much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source