mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
More informations for the Application info
This adds the rpc_origin, bot_public and bot_require_code_grant attributes
This commit is contained in:
parent
39cb5f30b4
commit
395af228b1
@ -50,7 +50,8 @@ from collections import namedtuple
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
AppInfo = namedtuple('AppInfo', 'id name description icon owner')
|
||||
AppInfo = namedtuple('AppInfo',
|
||||
'id name description rpc_origins bot_public bot_require_code_grant icon owner')
|
||||
|
||||
def app_info_icon_url(self):
|
||||
"""Retrieves the application's icon_url if it exists. Empty string otherwise."""
|
||||
@ -962,8 +963,12 @@ class Client:
|
||||
Retrieving the information failed somehow.
|
||||
"""
|
||||
data = await self.http.application_info()
|
||||
if 'rpc_origins' not in data:
|
||||
data['rpc_origins'] = None
|
||||
return AppInfo(id=int(data['id']), name=data['name'],
|
||||
description=data['description'], icon=data['icon'],
|
||||
rpc_origins=data['rpc_origins'], bot_public=data['bot_public'],
|
||||
bot_require_code_grant=data['bot_require_code_grant'],
|
||||
owner=User(state=self._connection, data=data['owner']))
|
||||
|
||||
async def get_user_info(self, user_id):
|
||||
|
18
docs/api.rst
18
docs/api.rst
@ -566,6 +566,24 @@ Application Info
|
||||
|
||||
The owner of the application. This is a :class:`User` instance
|
||||
with the owner's information at the time of the call.
|
||||
|
||||
.. attribute:: bot_public
|
||||
|
||||
``True`` if the bot is considered as public, else ``False``.
|
||||
Determines if the bot can be invited by anyone or if it is locked
|
||||
to the token owner. Correspond to the "Public bot" box in the
|
||||
token settings.
|
||||
|
||||
.. attribute:: bot_require_code_grant
|
||||
|
||||
``True`` if the bot requires code grant, else ``False``.
|
||||
Correspond to the "Bot requires code grant" box in the token
|
||||
settings.
|
||||
|
||||
.. attribute:: rpc_origins
|
||||
|
||||
Returns an array of RPC origin URL strings, if RPC is enabled.
|
||||
If RPC isn't enabled, returns ``None``.
|
||||
|
||||
Profile
|
||||
---------
|
||||
|
Loading…
x
Reference in New Issue
Block a user