DiscordApiClient

Discord api client that adds http information to requests.

Also can be mocked when testing.

Attributes

debug_options : None | set<str>

Debug options used when requesting towards Discord.

global_rate_limit_expires_at : float

The time when global rate limit will expire in monotonic time.

handlers : WeakMap<RateLimitHandler>

Rate limit handlers of the Discord requests.

headers : IgnoreCaseMultiValueDictionary

Headers used by every every Discord request.

http : HTTPClient

The used http client.

Methods

__new__(bot, token, ...)

Creates a new Discord api client.

ParameterTypeOptionalKeyword onlyDefaultDescription
bot

bool

Whether the respective client is a bot.

token

str

The client's token.

debug_options

None | set<str>

None

Http debug options, like 'canary'(I don't know more either).

proxy_auth

None | str

None

Proxy authorization for the session's requests.

http

None | HTTPClient = None

The http client to use instead of creating a new one.

proxy_url

None | str

None

Proxy url for the session's requests.

achievement_create()

achievement_delete()

achievement_edit()

achievement_get()

achievement_get_all()

application_command_global_create()

application_command_global_delete()

application_command_global_edit()

application_command_global_get()

application_command_global_get_all()

application_command_global_update_multiple()

application_command_guild_create()

application_command_guild_delete()

application_command_guild_edit()

application_command_guild_get()

application_command_guild_get_all()

application_command_guild_update_multiple()

application_command_permission_edit()

application_command_permission_get()

application_command_permission_get_all_guild()

application_edit_own()

application_get()

application_get_all_detectable()

application_get_own()

application_role_connection_metadata_edit_all()

application_role_connection_metadata_get_all()

audit_log_get_chunk()

auto_moderation_rule_create()

auto_moderation_rule_delete()

auto_moderation_rule_edit()

auto_moderation_rule_get()

auto_moderation_rule_get_all()

bulk_ack()

channel_create()

channel_delete()

channel_directory_counts()

channel_directory_get_all()

channel_directory_search()

channel_edit()

channel_edit_status()

channel_follow()

channel_group_create()

channel_group_edit()

channel_group_leave()

channel_group_user_add()

channel_group_user_delete()

channel_group_user_get_all()

channel_move()

channel_pin_ack()

channel_pin_get_all()

channel_private_create()

channel_private_get_all()

channel_thread_get_chunk_active()

channel_thread_get_chunk_archived_private()

channel_thread_get_chunk_archived_public()

channel_thread_get_chunk_self_archived()

client_connection_get_all()

client_edit()

client_gateway_bot()

client_gateway_hooman()

client_guild_profile_edit()

client_guild_profile_nick_edit()

client_logout()

client_settings_edit()

client_settings_get()

client_user_get()

discord_request(handler, method, url, ...)

Does a request towards Discord.

This method is a coroutine.

ParameterTypeOptionalDefaultDescription
handler

RateLimitHandler, StackedStaticRateLimitHandler

Rate limit handler for the request.

method

str

The method of the request.

url

str

The url to request.

data

None, object

None

Payload to request with.

params

None, object

None

Query parameters.

headers

None, IgnoreCaseMultiValueDictionary

None

Headers to do the request with. If passed then the session's own headers wont be used.

reason

None, str

None

Shows up at the request's respective guild if applicable.

Returns

response_data : object

Raises

TypeError

data, params type is bad, or they contain object(s) with bad type.

ConnectionError

No internet connection.

DiscordException

Any exception raised by the Discord API.

discovery_category_get_all()

discovery_guild_get_all()

discovery_stage_get_all()

discovery_validate_term()

emoji_create()

emoji_delete()

emoji_edit()

emoji_get()

emoji_guild_get_all()

entitlement_create()

entitlement_delete()

entitlement_get_chunk()

eula_get()

forum_tag_create()

forum_tag_delete()

forum_tag_edit()

greet()

guild_ack()

guild_ban_add()

guild_ban_delete()

guild_ban_get()

guild_ban_get_chunk()

guild_channel_get_all()

guild_create()

guild_delete()

guild_discovery_add_sub_category()

guild_discovery_delete_sub_category()

guild_discovery_edit()

guild_discovery_get()

guild_edit()

guild_embed_edit()

guild_embed_get()

guild_get()

guild_get_chunk()

guild_incidents_edit()

guild_inventory_settings_edit()

guild_leave()

guild_preview_get()

guild_prune()

guild_prune_estimate()

guild_role_get_all()

guild_thread_get_all_active()

guild_user_add()

guild_user_delete()

guild_user_get()

guild_user_get_chunk()

guild_user_search()

guild_voice_region_get_all()

guild_widget_get()

hypesquad_house_change()

hypesquad_house_leave()

integration_create()

integration_delete()

integration_edit()

integration_get_all()

integration_sync()

interaction_followup_message_create()

interaction_followup_message_delete()

interaction_followup_message_edit()

interaction_followup_message_get()

interaction_response_message_create()

interaction_response_message_delete()

interaction_response_message_edit()

interaction_response_message_get()

invite_create()

invite_delete()

invite_edit_vanity()

invite_get()

invite_get_all_channel()

invite_get_all_guild()

invite_get_vanity()

message_ack()

message_create()

message_crosspost()

message_delete()

message_delete_b2wo()

message_delete_multiple()

message_edit()

message_get()

message_get_chunk()

message_interaction()

message_pin()

message_suppress_embeds()

message_unpin()

oauth2_application_get_own()

oauth2_token()

onboarding_screen_edit()

onboarding_screen_get()

permission_overwrite_create()

permission_overwrite_delete()

reaction_add()

reaction_clear()

reaction_delete()

reaction_delete_emoji()

reaction_delete_own()

reaction_user_get_chunk()

relationship_create()

relationship_delete()

relationship_friend_request()

role_create()

role_delete()

role_edit()

role_move()

scheduled_event_create()

scheduled_event_delete()

scheduled_event_edit()

scheduled_event_get()

scheduled_event_get_all_guild()

scheduled_event_user_get_chunk()

sku_get_all()

soundboard_sound_create()

soundboard_sound_delete()

soundboard_sound_edit()

soundboard_sound_get_all_default()

stage_create()

stage_delete()

stage_edit()

stage_get()

stage_get_all()

status_incident_unresolved()

status_maintenance_active()

status_maintenance_upcoming()

sticker_create()

sticker_delete()

sticker_edit()

sticker_get()

sticker_get_all_guild()

sticker_get_guild()

sticker_pack_get()

sticker_pack_get_all()

thread_create()

thread_create_from_message()

thread_join()

thread_leave()

thread_self_settings_edit()

thread_user_add()

thread_user_delete()

thread_user_get()

thread_user_get_chunk()

typing()

user_achievement_get_all()

user_achievement_update()

user_application_role_connection_edit()

user_application_role_connection_get()

user_connection_get_all()

user_get()

user_get_profile()

user_guild_get_all()

user_guild_profile_edit()

user_info_get()

user_move()

user_role_add()

user_role_delete()

verification_screen_edit()

verification_screen_get()

voice_region_get_all()

voice_state_client_edit()

voice_state_user_edit()

webhook_create()

webhook_delete()

webhook_delete_token()

webhook_edit()

webhook_edit_token()

webhook_get()

webhook_get_all_channel()

webhook_get_all_guild()

webhook_get_token()

webhook_message_create()

webhook_message_delete()

webhook_message_edit()

webhook_message_get()

welcome_screen_edit()

welcome_screen_get()

__getattr__()

Drops a rich attribute error.