Сам код:
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
token = ',,,,'
bot = commands.Bot(intents=intents, command_prefix='!')
with open('guild.txt','r') as file:
guild_ids=file.readline()
@bot.slash_command(name="first_slash", guild_ids=guild_ids)
async def first_slash(ctx):
await ctx.respond("You executed the slash command!")
bot.run(token)
Токен убрал чтобы не зашли с моего бота
Ошибка:
Ignoring exception in on_connect
Traceback (most recent call last):
File "C:\Users\Msi_Pc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Msi_Pc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1025, in on_connect
await self.sync_commands()
File "C:\Users\Msi_Pc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 558, in sync_commands
registered_guild_commands[guild_id] = await self.register_commands(
File "C:\Users\Msi_Pc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 471, in register_commands
registered = await register("bulk", data)
File "C:\Users\Msi_Pc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\http.py", line 351, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access