disco.api.client
Classes
Responses
Inherits From list
Functions
rate_limited_duration(self
)
rate_limited(self
)
APIClient
Inherits From LoggingClass
An abstraction over a :class:disco.api.http.HTTPClient
, which composes
requests from provided data, and fits models with the returned data. The APIClient
is the only path to the API used within models/other interfaces, and it's
the recommended path for all third-party users/implementations.
Args
Name | Type | Description |
---|---|---|
token | str |
The Discord authentication token (without prefixes) to be used for all HTTP requests. |
client | Optional[:class:`disco.client.Client`] |
The Disco client this APIClient is a member of. This is used when constructing and fitting models from response data. |
Attributes
Name | Type | Description |
---|---|---|
client | Optional[:class:`disco.client.Client`] |
The Disco client this APIClient is a member of. |
http | :class:`disco.http.HTTPClient` |
The HTTPClient this APIClient uses for all requests. |
Functions
init(self, token, client)
_after_requests(self, response)
capture(self
)
Context manager which captures all requests made, returning a special
Responses
list, which can be used to introspect raw API responses. This
method is a low-level utility which should only be used by experienced users.
gateway_get(self
)
gateway_bot_get(self
)
channels_get(self, channel)
channels_modify(self, channel, reason,**kwargs)
channels_delete(self, channel, reason)
channels_typing(self, channel)
channels_messages_list(self, channel, around, before=None, after=None, limit=50)
channels_messages_get(self, channel, message)
channels_messages_create(self, channel, content, nonce=None, tts=False, attachment=None, attachments=[], embed=None, sanitize=False)
channels_messages_modify(self, channel, message, content, embed=None, sanitize=False)
channels_messages_delete(self, channel, message)
channels_messages_delete_bulk(self, channel, messages)
channels_messages_reactions_get(self, channel, message, emoji, after, limit=100)
channels_messages_reactions_create(self, channel, message, emoji)
channels_messages_reactions_delete(self, channel, message, emoji, user)
channels_permissions_modify(self, channel, permission, allow, deny, typ, reason)
channels_permissions_delete(self, channel, permission, reason)
channels_invites_list(self, channel)
channels_invites_create(self, channel, max_age, max_uses=0, temporary=False, unique=False, reason=None)
channels_pins_list(self, channel)
channels_pins_create(self, channel, message)
channels_pins_delete(self, channel, message)
channels_webhooks_create(self, channel, name, avatar=None)
channels_webhooks_list(self, channel)
guilds_get(self, guild)
guilds_modify(self, guild, reason,**kwargs)
guilds_delete(self, guild)
guilds_channels_list(self, guild)
guilds_channels_create(self, guild, channel_type, name, bitrate, user_limit=None, permission_overwrites=[], nsfw=None, parent_id=None, position=None, reason=None)
guilds_channels_modify(self, guild, channel, position, reason)
guilds_members_list(self, guild, limit, after=None)
guilds_members_get(self, guild, member)
guilds_members_modify(self, guild, member, reason,**kwargs)
guilds_members_roles_add(self, guild, member, role, reason)
guilds_members_roles_remove(self, guild, member, role, reason)
guilds_members_me_nick(self, guild, nick)
guilds_members_kick(self, guild, member, reason)
guilds_bans_list(self, guild)
guilds_bans_create(self, guild, user, delete_message_days, reason=None)
guilds_bans_delete(self, guild, user, reason)
guilds_roles_list(self, guild)
guilds_roles_create(self, guild, name, permissions=None, color=None, hoist=None, mentionable=None, reason=None)
guilds_roles_modify_batch(self, guild, roles, reason)
guilds_roles_modify(self, guild, role, name, hoist=None, color=None, permissions=None, position=None, mentionable=None, reason=None)
guilds_roles_delete(self, guild, role, reason)
guilds_invites_list(self, guild)
guilds_webhooks_list(self, guild)
guilds_emojis_list(self, guild)
guilds_emojis_create(self, guild, reason,**kwargs)
guilds_emojis_modify(self, guild, emoji, reason,**kwargs)
guilds_emojis_delete(self, guild, emoji, reason)
guilds_auditlogs_list(self, guild, before, user_id=None, action_type=None, limit=50)
users_me_get(self
)
users_me_patch(self, payload)
users_me_guilds_delete(self, guild)
users_me_dms_create(self, recipient_id)
invites_get(self, invite)
invites_delete(self, invite, reason)
webhooks_get(self, webhook)
webhooks_modify(self, webhook, name, avatar=None, reason=None)
webhooks_delete(self, webhook, reason)
webhooks_token_get(self, webhook, token)
webhooks_token_modify(self, webhook, token, name, avatar=None)
webhooks_token_delete(self, webhook, token)
webhooks_token_execute(self, webhook, token, data, wait)
Functions
optional(**kwargs</code>)
Takes a set of keyword arguments, creating a dictionary with only the non- null values.
:returns: dict