在命令中添加斜杠后,我得到了这个错误。这有什么关系呢?谷歌提供的信息根本没有帮助。
我的代码是:
from discord.ext import commands
from discord import app_commands
import asyncio
from config import settings
bot = commands.Bot(intents=discord.Intents.all(), command_prefix=settings['prefix'])
class abot(discord.Client):
def __init__(self):
super().__init__(intents=discord.Intents.default())
self.synced = False
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
await tree.sync(guild=discord.Object(id=settings['id'])) #error in this stroke
self.synced = True
print('ONLINE')
bot = abot()
tree = app_commands.CommandTree(bot)
@tree.command(name='ping', description='Ping me', guild=discord.Object(id=settings['id']))
async def self(interaction: discord.Integration):
author = interaction.message.author
await interaction.response.send_message(f'hello, {author.mention}')
bot.run(settings['token'])
错误是:
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
发布于 2022-10-09 09:57:34
问题是,我把bot ID放在guild_id中,而不是聊天ID。
发布于 2022-09-27 18:20:34
可能有两个原因,你的机器人不工作。
https://stackoverflow.com/questions/73864420
复制相似问题