restcord是discord api的restapi包装器,但这个包装器不包括websockets,它是为那些不需要websockets但只向api发出请求的人设计的。
Restcord的Python项目详细描述
restcord是discord api的restapi包装器,但这个不是 包括websockets,这是为那些不想要websockets但只想要websockets的人准备的 向api发出请求。
中断更改
不协调api不断变化,包装器api也在变化。
安装
要安装库,只需运行以下命令:
pip install -U restcord
请注意,在Linux安装Voice时,必须安装 通过您喜爱的包管理器(例如apt,跟踪包, yum等)在运行上述命令之前:
- python dev(例如,python 3.5的python3.5-dev)
快速示例
importrestcordimportasyncioloop=asyncio.get_event_loop()client=restcord.Restcord(token="Your token here")asyncdeftest():guild=awaitclient.get_guild("Some guild id of a guild that ur bot/user account is in")print(guild.__dict__)loop.run_until_complete(test())
对于用户帐户:
importrestcordimportasyncioloop=asyncio.get_event_loop()client=restcord.Restcord(token="Your token here",selfbot=True)asyncdeftest():guild=awaitclient.get_guild("Some guild id of a guild that ur bot/user account is in")print(guild.__dict__)loop.run_until_complete(test())
要求
- python 3.4.2+(不需要增加对更低版本的支持 版本)
- aiohttp库
通常pip会为您处理这些问题。