2017-10-14 23 views
0

我想看看我是否能得到一个僵尸自动加入我的服务器,但是当我写的代码,然后运行它,我得到这个异常:龃龉 - accept_invite()错误403

Ignoring exception in on_ready 
Traceback (most recent call last): 
    File "C:\Users\datpe\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 275, in _run_event 
    yield from getattr(self, event)(*args, **kwargs) 
    File "C:\Users\datpe\Desktop\Python Files\discord.py-async\examples\basic_bot.py", line 7, in on_ready 
    await client.accept_invite('https://discord.gg/AFBEwNE') 
    File "C:\Users\datpe\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 2237, in accept_invite 
    yield from self.http.accept_invite(invite_id) 
    File "C:\Users\datpe\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\http.py", line 133, in request 
    raise Forbidden(r, data) 
discord.errors.Forbidden: FORBIDDEN (status code: 403): Bots cannot use this endpoint 

正如你可以看到,我的请求得到了Forbidden,因为机器人不能使用这个端点

有人能给我一些见解吗?

而且,这里是我的代码:

import discord 

client = discord.Client() 

@client.event 
async def on_ready(): 
    await client.accept_invite('https://discord.gg/AFBEwNE') 

client.run('Bot Token') 

回答

0

机器人不能接受邀请句号。您必须使用授权链接,该链接用于在三月的某段时间后创建的漫游器,使用漫游器的ID,以及在应用程序网页中使用应用程序ID之前使用该链接。

https://discordapp.com/oauth2/authorize?client_id=<BOTS_ID_HERE>&scope=bot 
+0

这么认为,这很糟糕。 –