有什么方法可以让不和谐的机器人通过 accept_invite 或类似的东西加入服务器?

2022-01-15 00:00:00 python discord discord.py

问题描述

注意:我使用的是 discord.py 0.16.12

Note: I'm using discord.py 0.16.12

我想知道是否有任何方法可以让机器人在代码中加入服务器.就像有一个命令是这样的:

I am wondering if there's any way to have a bot join a server within the code. Like there's a command that would be like:

@client.command(pass_context=True)
async def join(ctx, invite):
    client.join(invite)

我已经试过了

@client.command()
async def joinserver(mahlink):
    await client.accept_invite(mahlink)

它不起作用.这是我在谷歌上唯一能找到的关于这个

It dosen't work. This is the only thing I could find on google about this

另外,运行 accept_invite 会得到以下结果:

Also, running the accept_invite gives the following:

discord.errors.Forbidden: FORBIDDEN (status code: 403): Bots cannot use this endpoint

discord.errors.Forbidden: FORBIDDEN (status code: 403): Bots cannot use this endpoint


解决方案

除了手动邀请之外,机器人不能接受邀请或加入服务器/公会.具有管理服务器权限的用户必须授权机器人,并且在加入时将授予该机器人的权限.

Bots cannot accept invites or join servers/guilds any other way than being manually invited. A user with manager server permissions must authorize the bot and the permissions said bot will be granted upon joining.

您可以在这里

相关文章