dico.base.http module
- class dico.base.http.HTTPRequestBase
Bases:
ABCThis abstract class includes all API request methods.
Note
Although every GET route’s name in the API Documents starts with
Get ..., but they are all changed to request_… to prevent confusion with cache get methods.Part of interaction methods are merged to one, since those are listed as separate endpoint but only the difference is the ID.
Warning
This module isn’t intended to be directly used. It is recommended to request via APIClient.
- BASE_URL = 'https://discord.com/api/v10'
- abstract request(route, meth, body=None, *, is_json=False, reason_header=None, retry=3, **kwargs)
This function includes requesting REST API. :return: Response.
- request_guild_audit_log(guild_id, user_id=None, action_type=None, before=None, limit=None)
Sends get guild audit log request.
- Parameters
guild_id – ID of the guild to get audit log.
user_id – ID of the user who did the action.
action_type – Type of the action.
before – Entry ID to get before.
limit – Maximum number of the audit log to get.
- request_channel(channel_id)
Sends get channel request.
- Parameters
channel_id – Channel ID to request.
- modify_guild_channel(channel_id, name=None, channel_type=None, position=Empty, topic=Empty, nsfw=Empty, rate_limit_per_user=Empty, bitrate=Empty, user_limit=Empty, permission_overwrites=Empty, parent_id=Empty, rtc_region=Empty, video_quality_mode=Empty, reason=None)
Sends modify channel request, for guild channel.
- Parameters
channel_id – Channel ID to request.
name – Name to change.
channel_type – Type of the channel.
position – Channel position.
topic – Channel topic to change.
nsfw – Whether the channel is NSFW.
rate_limit_per_user – Rate limit seconds of the channel.
bitrate – Bitrate of the channel.
user_limit – Limitation of the user count.
permission_overwrites – Specific permissions for user of role.
parent_id – Parent category ID.
rtc_region – Voice region ID.
video_quality_mode – Video quality of the channel.
reason – Reason of the action.
- modify_group_dm_channel(channel_id, name=None, icon=None, reason=None)
Sends modify channel request, for group DM.
- Parameters
channel_id – Channel ID to request.
name – Name to change.
icon – base64 encoded icon.
reason – Reason of the action.
- modify_thread_channel(channel_id, name=None, archived=None, auto_archive_duration=None, locked=None, rate_limit_per_user=Empty, reason=None)
Sends modify channel request, for thread channel.
- Parameters
channel_id – Channel ID to request.
name – Name to change.
archived – Whether to se the channel to archived.
auto_archive_duration – Duration to automatically archive the channel.
locked – Whether to lock the thread.
rate_limit_per_user – Rate limit seconds of the thread.
reason – Reason of the action.
- delete_channel(channel_id, reason=None)
Sends channel delete/close request.
- Parameters
channel_id – Channel ID to request.
reason – Reason of the action.
- property close_channel
Alias of
delete_channel().
- request_channel_messages(channel_id, around=None, before=None, after=None, limit=None)
Sends channel messages get request.
- Parameters
channel_id – Channel ID to request.
around – Channel ID to get messages around it.
before – Channel ID to get messages before it.
:param after:Channel ID to get messages after it. :param limit: Maximum messages to get.
- request_channel_message(channel_id, message_id)
Sends single channel message get request.
- Parameters
channel_id – Channel ID to request.
message_id – Message ID to request.
- create_message(channel_id, content=None, nonce=None, tts=False, embeds=None, allowed_mentions=None, message_reference=None, components=None, sticker_ids=None)
Sends create message request.
- Parameters
channel_id – ID of the channel.
content – Content of the message.
nonce –
tts – Whether this message is TTS.
embeds – List of embeds of the message.
allowed_mentions – Allowed mentions of the message.
message_reference – Message to reference.
components – Components of the message.
sticker_ids – List of ID of the stickers.
- abstract create_message_with_files(channel_id, content=None, files=None, nonce=None, tts=None, embeds=None, allowed_mentions=None, message_reference=None, components=None, sticker_ids=None, attachments=None)
Sends create message request with files.
- Parameters
channel_id – ID of the channel.
content – Content of the message.
files – Files of the message.
nonce –
tts – Whether this message is TTS.
embeds – List of embeds of the message.
allowed_mentions – Allowed mentions of the message.
message_reference – Message to reference.
components – Components of the message.
sticker_ids – List of ID of the stickers.
attachments – List of attachment objects.
- crosspost_message(channel_id, message_id)
Sends crosspost message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to crosspost.
- create_reaction(channel_id, message_id, emoji)
Sends create reaction request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to react.
emoji – Emoji to add.
- delete_reaction(channel_id, message_id, emoji, user_id='@me')
Sends delete reaction request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to request.
emoji – Emoji to delete.
user_id – User ID to delete reaction. Pass
@meto remove own.
- request_reactions(channel_id, message_id, emoji, after=None, limit=None)
Sends get reactions request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to request.
emoji – Emoji to request.
after – User ID to request after this user.
limit – Maximum number to request.
- delete_all_reactions(channel_id, message_id)
Sends delete all reactions request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to request.
- delete_all_reactions_emoji(channel_id, message_id, emoji)
Sends delete all reactions emoji request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to request.
emoji – Emoji to delete.
- edit_message(channel_id, message_id, content=Empty, embeds=Empty, flags=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)
Sends edit message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to edit.
content – Content of the message.
embeds – List of embeds of the message.
flags – Flags of the message.
allowed_mentions – Allowed mentions of the message.
attachments – Attachments to keep.
components – Components of the message.
- Returns
Message object dict.
- abstract edit_message_with_files(channel_id, message_id, content=Empty, embeds=Empty, flags=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)
Sends edit message request with files.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to edit.
content – Content of the message.
embeds – List of embeds of the message.
flags – Flags of the message.
files – Files of the message.
allowed_mentions – Allowed mentions of the message.
attachments – Attachments to keep.
components – Components of the message.
- Returns
Message object dict.
- delete_message(channel_id, message_id, reason=None)
Sends delete message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to edit.
reason – Reason of the action.
- bulk_delete_messages(channel_id, message_ids, reason=None)
Sends bulk delete message request.
- Parameters
channel_id – ID of the channel.
message_ids – List of the message IDs to delete.
reason – Reason of the action.
- edit_channel_permissions(channel_id, overwrite_id, allow, deny, overwrite_type, reason=None)
Sends edit channel permissions request.
- Parameters
channel_id – ID of the channel.
overwrite_id – Role or Member ID to edit permissions.
allow – What permissions to allow.
deny – What permissions to deny.
overwrite_type – Type of the overwrite target. Set to 0 for Role, and 1 for Member.
reason – Reason of the action.
- request_channel_invites(channel_id)
Sends get channel invites request.
- Parameters
channel_id – ID of the channel.
- create_channel_invite(channel_id, max_age=None, max_uses=None, temporary=None, unique=None, target_type=None, target_user_id=None, target_application_id=None, reason=None)
Sends create channel invite request.
- Parameters
channel_id – ID of the channel.
max_age – Maximum age in seconds.
max_uses – Maximum uses.
temporary – Whether the invite only grants temporary membership.
unique – Whether the invite is unique.
target_type – Type of the invite.
target_user_id – User ID to target to.
target_application_id – Application ID to target to.
reason – Reason of the action.
- delete_channel_permission(channel_id, overwrite_id, reason=None)
Sends delete channel permissions request.
- Parameters
channel_id – ID of the channel.
overwrite_id – ID of the target user/role.
reason – Reason of the action.
- follow_news_channel(channel_id, webhook_channel_id)
Sends follow news channel request.
- Parameters
channel_id – ID of the channel to follow.
webhook_channel_id – Target channel ID.
- trigger_typing_indicator(channel_id)
Sends trigger typing indicator request.
- Parameters
channel_id – ID of the channel.
- request_pinned_messages(channel_id)
Sends get pinned messages request.
- Parameters
channel_id – ID of the channel.
- pin_message(channel_id, message_id, reason=None)
Sends pin message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to pin.
reason – Reason of the action.
- unpin_message(channel_id, message_id, reason=None)
Sends unpin message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to unpin.
reason – Reason of the action.
- group_dm_add_recipient(channel_id, user_id, access_token, nick)
Sends group dm add recipient request.
- Parameters
channel_id – ID of the group dm channel.
user_id – ID of the user to add.
access_token – Access token.
nick – Nickname of the user.
- group_dm_remove_recipient(channel_id, user_id)
Sends group dm remove recipient request.
- Parameters
channel_id – ID of the group dm channel.
user_id – ID of the user to remove.
- start_thread_with_message(channel_id, message_id, name, auto_archive_duration, reason=None)
Sends start thread with message request.
- Parameters
channel_id – ID of the channel.
message_id – ID of the message to create thread.
name – Name of the thread channel.
auto_archive_duration – Duration in minute to automatically close after recent activity.
reason – Reason of the action.
- start_thread_without_message(channel_id, name, auto_archive_duration, thread_type=None, invitable=None, reason=None)
Sends start thread without message request.
- Parameters
channel_id – ID of the channel to create thread.
name – Name of the thread channel.
auto_archive_duration – Duration in minute to automatically close after recent activity.
thread_type – Type of the thread.
invitable – Whether this thread is invitable.
reason – Reason of the action.
- join_thread(channel_id)
Sends join thread request.
- Parameters
channel_id – ID of the thread channel to join.
- add_thread_member(channel_id, user_id)
Sends add thread member request.
- Parameters
channel_id – ID of the thread channel.
user_id – ID of the user to add.
- leave_thread(channel_id)
Sends leave thread request.
- Parameters
channel_id – ID of the thread channel to leave.
- remove_thread_member(channel_id, user_id)
Sends remove thread member request.
- Parameters
channel_id – ID of the thread channel.
user_id – ID of the user to remove.
- list_thread_members(channel_id)
Sends list thread members request.
- Parameters
channel_id – ID of the thread channel.
- list_public_archived_threads(channel_id, before=None, limit=None)
Sends list public archived threads request.
- Parameters
channel_id – ID of the channel.
before – ISO8601 timestamp to get threads before this.
limit – Limit to return.
- list_private_archived_threads(channel_id, before=None, limit=None)
Sends list private archived threads request.
- Parameters
channel_id – ID of the channel.
before – ISO8601 timestamp to get threads before this.
limit – Limit to return.
- list_joined_private_archived_threads(channel_id, before=None, limit=None)
Sends list joined private archived threads request.
- Parameters
channel_id – ID of the channel.
before – ISO8601 timestamp to get threads before this.
limit – Limit to return.
- list_guild_emojis(guild_id)
Sends list guild emojis request.
- Parameters
guild_id – ID of the guild.
- request_guild_emoji(guild_id, emoji_id)
Sends get guild emoji request.
- Parameters
guild_id – ID of the guild.
emoji_id – ID of the emoji to request.
- create_guild_emoji(guild_id, name, image, roles, reason=None)
Sends create guild emoji request.
- Parameters
guild_id – ID of the guild.
name – Name of the emoji.
image – Image data of the emoji.
roles – Roles that are allowed to use this emoji.
reason – Reason of the action.
- modify_guild_emoji(guild_id, emoji_id, name=Empty, roles=Empty, reason=None)
Sends modify guild emoji request.
- Parameters
guild_id – ID of the guild.
emoji_id – ID of the emoji.
name – Name of the emoji to change.
roles – Roles to change.
reason – Reason of the action.
- delete_guild_emoji(guild_id, emoji_id, reason=None)
Sends delete guild emoji request.
- Parameters
guild_id – ID of the guild.
emoji_id – ID of the emoji to delete.
reason – Reason of the action.
- create_guild(name, icon=None, verification_level=None, default_message_notifications=None, explicit_content_filter=None, roles=None, channels=None, afk_channel_id=None, afk_timeout=None, system_channel_id=None, system_channel_flags=None)
Sends create guild request.
Note
Param
regionis not supported since it is deprecated.- Parameters
name – Name of the guild.
icon – Icon data of the guild to create.
verification_level – Verification level of the guild to create.
default_message_notifications – Default message notification level of the guild to create.
explicit_content_filter – Explicit content filter level of the guild to create.
roles – Roles of the guild to create.
channels – Channels of the guild to create.
afk_channel_id – AFK channel ID of the guild to create.
afk_timeout – AFK timeout of the guild to create.
system_channel_id – System channel ID of the guild to create.
system_channel_flags – System channel flags of the guild to create.
- request_guild(guild_id, with_counts=False)
Sends get guild request.
- Parameters
guild_id – ID of the guild to request.
with_counts – Whether to return member and presence count.
- request_guild_preview(guild_id)
Sends get guild request.
- Parameters
guild_id – ID of the guild to request.
- modify_guild(guild_id, name=None, verification_level=Empty, default_message_notifications=Empty, explicit_content_filter=Empty, afk_channel_id=Empty, afk_timeout=None, icon=Empty, owner_id=None, splash=Empty, discovery_splash=Empty, banner=Empty, system_channel_id=Empty, system_channel_flags=None, rules_channel_id=Empty, public_updates_channel_id=Empty, preferred_locale=Empty, features=None, description=Empty, reason=None)
Sends create guild request.
Note
Param
regionis not supported since it is deprecated.- Parameters
guild_id – ID of the guild to modify.
name – Name of the guild.
verification_level – Verification level.
default_message_notifications – Default message notification level.
explicit_content_filter – Explicit content filter level.
afk_channel_id – AFK channel ID.
afk_timeout – AFK timeout.
icon – Icon image data.
owner_id – ID of the owner. Bot must be owner of the guild.
splash – Splash image data.
discovery_splash – Discovery splash image data.
banner – Banner image data.
system_channel_id – System channel ID.
system_channel_flags – System channel flags.
rules_channel_id – Rules channel ID.
public_updates_channel_id – Discord community notes receive channel ID.
preferred_locale – Preferred locale of the guild.
features – Enabled guild features list.
description – Description of the guild.
reason – Reason of the action.
- delete_guild(guild_id)
Sends delete guild request. Bot must be owner of the guild.
- Parameters
guild_id – ID of the guild to delete.
- request_guild_channels(guild_id)
Sends get guild channels request.
- Parameters
guild_id – ID of the guild.
- create_guild_channel(guild_id, name, channel_type=None, topic=None, bitrate=None, user_limit=None, rate_limit_per_user=None, position=None, permission_overwrites=None, parent_id=None, nsfw=None, reason=None)
Sends create guild channel request.
- Parameters
guild_id – ID of the guild.
name – Name of the channel to create.
channel_type – Type of the channel.
topic – Topic of the channel.
bitrate – Bitrate of the channel.
user_limit – User limit of the channel.
rate_limit_per_user – Rate limit per user of the channel.
position – Position of the channel.
permission_overwrites – Permission overwrites of the channel.
parent_id – Parent ID of the channel.
nsfw – Whether this channel is NSFW.
reason – Reason of the action.
- modify_guild_channel_positions(guild_id, params, reason=None)
Sends modify guild channel positions request.
- Parameters
guild_id – ID of the guild.
params – List of channel params to modify.
reason – Reason of the action.
- list_active_threads(guild_id)
Sends list active threads request.
- Parameters
guild_id – ID of the guild.
- request_guild_member(guild_id, user_id)
Sends get guild member request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user to request.
- list_guild_members(guild_id, limit=None, after=None)
Sends list guild members request.
- Parameters
guild_id – ID of the guild.
limit – Limit of the member count to get.
after – The highest user ID in the previous page.
- search_guild_members(guild_id, query, limit=None)
Sends search guild members request.
- Parameters
guild_id – ID of the guild.
query – Query matching to usernames or nicknames to search.
limit – Limit of the member count to get.
- add_guild_member(guild_id, user_id, access_token, nick=None, roles=None, mute=None, deaf=None)
Sends add guild member request.
Note
This requires OAuth2 access token with
guilds.joinscope.- Parameters
guild_id – ID of the guild.
user_id – ID of the user to add.
access_token – OAuth2 access token with
guilds.joinscope.nick – Nickname to set.
roles – Roles to add. Using this will bypass membership screening.
mute – Whether to mute this user in voice channel.
deaf – Whether to deaf this user in voice channel.
- modify_guild_member(guild_id, user_id, nick=Empty, roles=Empty, mute=Empty, deaf=Empty, channel_id=Empty, communication_disabled_until=Empty, reason=None)
Sends modify guild member request.
Note
Nonecan be used for all params.- Parameters
guild_id – ID of the guild.
user_id – ID of the user to edit.
nick – Nickname to change.
roles – Roles to assign.
mute – Whether to mute this user in voice channel.
deaf – Whether to deaf this user in voice channel.
channel_id – Voice channel to move.
communication_disabled_until – When user’s timeout will be expired. Set None to remove.
reason – Reason of the action.
- modify_current_user_nick(guild_id, nick=Empty, reason=None)
Sends modify current user nick request.
- Parameters
guild_id – ID of the guild.
nick – Nickname to change.
reason – Reason of the action.
- add_guild_member_role(guild_id, user_id, role_id, reason=None)
Sends add guild member role request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user.
role_id – ID of the role to add.
reason – Reason of the action.
- remove_guild_member_role(guild_id, user_id, role_id, reason=None)
Sends remove guild member role request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user.
role_id – ID of the role to remove.
reason – Reason of the action.
- remove_guild_member(guild_id, user_id)
Sends remove guild member request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user to remove.
- request_guild_bans(guild_id)
Sends get guild bans request.
- Parameters
guild_id – ID of the guild.
- request_guild_ban(guild_id, user_id)
Sends get guild ban request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user.
- create_guild_ban(guild_id, user_id, delete_message_days=None, reason=None)
Sends create guild ban request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user to ban.
delete_message_days – Days of message sent by banned user to delete.
reason – Reason of the action.
- remove_guild_ban(guild_id, user_id, reason=None)
Sends remove guild ban request.
- Parameters
guild_id – ID of the guild.
user_id – ID of the user tom remove ban.
reason – Reason of the action.
- request_guild_roles(guild_id)
Sends get guild roles request.
- Parameters
guild_id – ID of the guild.
- create_guild_role(guild_id, name=None, permissions=None, color=None, hoist=None, mentionable=None, reason=None)
Sends create guild role request.
- Parameters
guild_id – ID of the guild.
name – Name of the role.
permissions – Permissions of the role.
color – Color of the role.
hoist – Whether role should be displayed separately.
mentionable – Whether the role is mentionable.
reason – Reason of the action.
- modify_guild_role_positions(guild_id, params, reason=None)
Sends modify guild role positions request.
- Parameters
guild_id – ID of the guild.
params – List of
{"id": role ID, "position": position}.reason – Reason of the action.
- modify_guild_role(guild_id, role_id, name=Empty, permissions=Empty, color=Empty, hoist=Empty, mentionable=Empty, reason=None)
Sends modify guild role request.
- Parameters
guild_id – ID of the guild.
role_id – ID of the role to modify.
name – Name of the role.
permissions – Permissions of the role.
color – Color of the role.
hoist – Whether role should be displayed separately.
mentionable – Whether the role is mentionable.
reason – Reason of the action.
- delete_guild_role(guild_id, role_id, reason=None)
Sends delete guild role request.
- Parameters
guild_id – ID of the guild.
role_id – ID of the role to delete.
reason – Reason of the action.
- request_guild_prune_count(guild_id, days=None, include_roles=None)
Sends get guild prune count request.
- Parameters
guild_id – ID of the guild.
days – Days to count prune.
include_roles – Roles to include.
- Returns
- begin_guild_prune(guild_id, days=None, compute_prune_count=None, include_roles=None, reason=None)
Sends begin guild prune request.
- Parameters
guild_id – ID of the guild.
days – Days to prune.
compute_prune_count – Whether to return
pruned.include_roles – Roles to include.
reason – Reason of the action.
- request_guild_voice_regions(guild_id)
Sends get guild voice regions request.
- Parameters
guild_id – ID of the guild.
- request_guild_invites(guild_id)
Sends get guild invites request.
- Parameters
guild_id – ID of the guild.
- request_guild_integrations(guild_id)
Sends get guild integrations request.
- Parameters
guild_id – ID of the guild.
- delete_guild_integration(guild_id, integration_id, reason=None)
Sends delete guild integration request.
- Parameters
guild_id – ID of the guild.
integration_id – ID of the integration to delete.
reason – Reason of the action.
- request_guild_widget_settings(guild_id)
Sends get guild widget settings request.
- Parameters
guild_id – ID of the guild.
- modify_guild_widget(guild_id, enabled=None, channel_id=Empty, reason=None)
Sends modify guild widget request.
- Parameters
guild_id – ID of the guild.
enabled – Whether the widget is enabled.
channel_id – ID of the channel for the widget.
reason – Reason of the action.
- request_guild_widget(guild_id)
Sends get guild widget request.
- Parameters
guild_id – ID of the guild.
- request_guild_vanity_url(guild_id)
Sends get guild vanity URL request.
- Parameters
guild_id – ID of the guild.
- request_guild_widget_image(guild_id, style=None)
Sends get guild widget image request.
- Parameters
guild_id – ID of the guild.
style – Style to use. Can be one of
shield,banner1,banner2,banner3, orbanner4.
- request_guild_welcome_screen(guild_id)
Sends get guild welcome screen request.
- Parameters
guild_id – ID of the guild.
- modify_guild_welcome_screen(guild_id, enabled=Empty, welcome_channels=Empty, description=Empty, reason=None)
Sends modify guild welcome screen request.
- Parameters
guild_id – ID of the guild.
enabled – Whether it is enabled.
welcome_channels – Welcome channels to link.
description – Description to show in welcome screen.
reason – Reason of the action.
- modify_user_voice_state(guild_id, channel_id, user_id='@me', suppress=None, request_to_speak_timestamp=None)
Sends modify curren user or user voice state requset.
- Parameters
guild_id – ID of the guild.
channel_id – ID of the stage channel.
user_id – ID of the user to modify. Set to
@mefor current user.suppress – Whether suppress is enabled.
request_to_speak_timestamp – When to set the user to request to speak. Exclusive to current user(
@me).
- list_scheduled_events_for_guild(guild_id, with_user_count=None)
Sends list scheduled events for guild.
- Parameters
guild_id – ID of the guild to list scheduled events.
with_user_count – Whether to include number of users subscribed to each event.
- create_guild_scheduled_event(guild_id, *, channel_id=None, entity_metadata=None, name, privacy_level, scheduled_start_time, scheduled_end_time=None, description=None, entity_type)
Sends create guild scheduled event request.
- Parameters
guild_id – ID of the guild to create.
channel_id – ID of the channel to schedule event. Optional if entity_type is EXTERNAL.
entity_metadata – Entity metadata of the event.
name – Name of the event.
privacy_level – Privacy level of the event.
scheduled_start_time – Scheduled start time of the event.
scheduled_end_time – Scheduled end time of the event.
description – Description of the event.
entity_type – Type of the entity of the event.
- request_guild_scheduled_event(guild_id, guild_scheduled_event_id, with_user_count=None)
Sends get guild scheduled event request.
- Parameters
guild_id – ID of the guild to get scheduled event.
guild_scheduled_event_id – ID of the scheduled event to get.
with_user_count – Whether to include number of users subscribed to this event.
- modify_guild_scheduled_event(guild_id, guild_scheduled_event_id, channel_id=Empty, entity_metadata=None, name=None, privacy_level=None, scheduled_start_time=None, scheduled_end_time=None, description=None, entity_type=None, status=None)
Sends modify guild scheduled event request.
- Parameters
guild_id – ID of the guild to modify scheduled events.
guild_scheduled_event_id – ID of the event to modify.
channel_id – ID of the channel of the event. Set to
Noneif you are changing event to EXTERNAL.entity_metadata – Entity metadata of the event.
name – Name of the event.
privacy_level – Privacy level of the event.
scheduled_start_time – Scheduled start time of the event.
scheduled_end_time – Scheduled end time of the event.
description – Description of the event.
entity_type – Type of the entity of the event.
status – Status of the event.
- delete_guild_scheduled_event(guild_id, guild_scheduled_event_id)
Sends delete guild scheduled event request.
- Parameters
guild_id – ID of the guild to delete scheduled event.
guild_scheduled_event_id – ID of the scheduled event to delete.
- request_guild_scheduled_event_users(guild_id, guild_scheduled_event_id, limit=None, with_member=None, before=None, after=None)
Sends get guild scheduled event users request.
- Parameters
guild_id – ID of the guild to get scheduled event users.
guild_scheduled_event_id – ID of the scheduled event to get users.
limit – Maximum number of users to return.
with_member – Whether to include member data.
before – ID of the user to get users before.
after – ID of the user to get users after.
- request_guild_template(template_code)
Sends get guild template request.
- Parameters
template_code – Code of the template.
- create_guild_from_template(template_code, name, icon=None)
Sends create guild from template request.
- Parameters
template_code – Code of the template.
name – Name of the guild.
icon – Icon of the guild.
- request_guild_templates(guild_id)
Sends get guild templates request.
- Parameters
guild_id – ID of the guild.
- create_guild_template(guild_id, name, description=Empty)
Sends create guild template request.
- Parameters
guild_id – ID of the guild.
name – Name of the template to create.
description – Description of the template
- sync_guild_template(guild_id, template_code)
Sends sync guild template request.
- Parameters
guild_id – ID of the guild.
template_code – Code of the template to sync.
- modify_guild_template(guild_id, template_code, name=None, description=Empty)
Sends modify guild template request.
- Parameters
guild_id – ID of the guild.
template_code – Code of the template.
name – Name to change.
description – Description to change.
- delete_guild_template(guild_id, template_code)
Sends delete guild template request.
- Parameters
guild_id – ID of the guild.
template_code – Code of the template.
- request_invite(invite_code, with_counts=None, with_expiration=None)
Sends get invite request.
- Parameters
invite_code – Code of the invite.
with_counts – Whether to include counts.
with_expiration – Whether to include expiration info.
- delete_invite(invite_code, reason=None)
Sends delete invite request.
- Parameters
invite_code – Code of the invite.
reason – Reason of the action.
- create_stage_instance(channel_id, topic, privacy_level=None, reason=None)
Sends create stage instance request.
- Parameters
channel_id – ID of the stage channel.
topic – Topic of the stage instance.
privacy_level – Privacy level of the stage.
reason – Reason of the action.
- request_stage_instance(channel_id)
Sends get stage instance request.
- Parameters
channel_id – ID of the channel.
- modify_stage_instance(channel_id, topic=None, privacy_level=None, reason=None)
Sends modify stage instance request.
- Parameters
channel_id – ID of the stage channel.
topic – Topic to change.
privacy_level – Privacy level to change.
reason – Reason of the action.
- delete_stage_instance(channel_id, reason=None)
Sends delete stage instance request.
- Parameters
channel_id – ID of the stage channel.
reason – Reason of the action.
- request_sticker(sticker_id)
Sends get sticker request.
- Parameters
sticker_id – ID of the sticker.
- list_nitro_sticker_packs()
Sends list nitro sticker packs request.
- list_guild_stickers(guild_id)
Sends list guild stickers request.
- Parameters
guild_id – ID of the guild.
- request_guild_sticker(guild_id, sticker_id)
Sends get guild sticker request.
- Parameters
guild_id – ID of the guild.
sticker_id – ID of the sticker to request.
- abstract create_guild_sticker(guild_id, name, description, tags, file, reason=None)
Sends create guild sticker request.
- Parameters
guild_id – ID of the guild.
name – Name of the sticker.
description – Description of the sticker.
tags – Autocomplete text.
file – Sticker file to upload. Max 500 KB.
reason – Reason of the action.
- modify_guild_sticker(guild_id, sticker_id, name=None, description=Empty, tags=None, reason=None)
Sends modify guild sticker request.
- Parameters
guild_id – ID of the guild.
sticker_id – ID of the sticker to modify.
name – Name to modify.
description – Description to modify. Can be None.
tags – Tags to edit.
reason – Reason of the action.
- delete_guild_sticker(guild_id, sticker_id, reason=None)
Sends delete guild sticker request.
- Parameters
guild_id – ID of the guild.
sticker_id – ID of sticker to delete.
reason – Reason of the action.
- request_user(user_id='@me')
Sends get user request.
- Parameters
user_id – ID of the user to get.
- modify_current_user(username=None, avatar=Empty)
Sends modify current user request. You can create avatar using
to_image_dataof utils.- Parameters
username – Name to modify.
avatar – Image data to modify.
- request_current_user_guilds()
Sends get current user guilds request.
- leave_guild(guild_id)
Sends leave guild request.
- Parameters
guild_id – ID of the guild to leave.
- create_dm(recipient_id)
Sends create dm request.
- Parameters
recipient_id – ID of the recipient to add.
- create_group_dm(access_tokens, nicks)
Sends create group dm request.
- Parameters
access_tokens – OAuth2 access tokens of the participants to add.
nicks – Dict of ID-nick to set.
- list_voice_regions()
Sends list voice regions request.
- create_webhook(channel_id, name, avatar=None)
Sends create webhook request.
- Parameters
channel_id – ID of the channel.
name – Name of the webhook.
avatar – URL of the avatar image.
- request_channel_webhooks(channel_id)
Sends get channel webhooks request.
- Parameters
channel_id – ID of the channel.
- request_guild_webhooks(guild_id)
Sends get guild webhooks request.
- Parameters
guild_id – ID of the guild.
- request_webhook(webhook_id)
Sends get webhook request.
- Parameters
webhook_id – ID of the webhook.
- request_webhook_with_token(webhook_id, webhook_token)
Sends get webhook request.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
- modify_webhook(webhook_id, name=None, avatar=None, channel_id=None)
Sends modify webhook request.
- Parameters
webhook_id – ID of the webhook.
name – Name of the webhook.
avatar – URL of the avatar image.
channel_id – ID of the channel.
- modify_webhook_with_token(webhook_id, webhook_token, name=None, avatar=None)
Sends modify webhook request.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
name – Name of the webhook.
avatar – URL of the avatar image.
- delete_webhook(webhook_id)
Sends delete webhook request.
- Parameters
webhook_id – ID of the webhook.
- delete_webhook_with_token(webhook_id, webhook_token)
Sends delete webhook request with token.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
- execute_webhook(webhook_id, webhook_token, wait=None, thread_id=None, content=None, username=None, avatar_url=None, tts=False, embeds=None, allowed_mentions=None, components=None, flags=None)
Sends execute webhook request.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
wait – Whether to wait response of the server.
thread_id – ID of the thread.
content – Content of the message.
username – Name of the webhook.
avatar_url – URL of the avatar image.
tts – Whether this message is TTS.
embeds – List of embeds of the message.
allowed_mentions – Allowed mentions of the message.
components – Components of the message.
flags – Flags of the message.
- Returns
Message object dict.
- abstract execute_webhook_with_files(webhook_id, webhook_token, wait=None, thread_id=None, content=None, username=None, avatar_url=None, tts=False, files=None, embeds=None, allowed_mentions=None, components=None, attachments=None, flags=None)
Sends execute webhook request with files.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
wait – Whether to wait response of the server.
thread_id – ID of the thread.
content – Content of the message.
username – Name of the webhook.
avatar_url – URL of the avatar image.
tts – Whether this message is TTS.
files – Files of the message.
embeds – List of embeds of the message.
allowed_mentions – Allowed mentions of the message.
components – Components of the message.
attachments – List of attachment objects.
flags – Flags of the message.
- request_webhook_message(webhook_id, webhook_token, message_id)
Sends get webhook message request.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
message_id – ID of the message
- abstract edit_webhook_message(webhook_id, webhook_token, message_id, content=Empty, embeds=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)
Sends edit webhook message request. :param webhook_id: ID of the webhook. :param webhook_token: Token of the webhook. :param message_id: ID of the message to edit. :param content: Content of the message. :param embeds: List of embed of the message. :param files: Files of the message. :param allowed_mentions: Allowed mentions of the message. :param attachments: Attachments to keep. :param components: Components of the message.
- delete_webhook_message(webhook_id, webhook_token, message_id)
Sends delete webhook message request.
- Parameters
webhook_id – ID of the webhook.
webhook_token – Token of the webhook.
message_id – ID of the message to edit.
- request_application_commands(application_id, guild_id=None)
Sends get global or guild application commands request.
- Parameters
application_id – ID of the application.
guild_id – ID of the guild. Set to None for global.
- create_application_command(application_id, name, description=None, options=None, default_permission=None, command_type=None, guild_id=None)
Sends create global or guild application command request.
- Parameters
application_id – ID of the application.
name – Name of the command.
description – Description of the command.
options – Options of the command.
default_permission – Whether the command is enabled as a default.
command_type – Type of the command.
guild_id – ID of the guild. Set to None for global.
- request_application_command(application_id, command_id, guild_id=None)
Sends get global or guild application command request.
- Parameters
application_id – ID of the application.
command_id – ID of the command to request.
guild_id – ID of the guild. Set to None for global.
- edit_application_command(application_id, command_id, name=None, description=None, options=None, default_permission=None, guild_id=None)
Sends edit global or guild application command request.
- Parameters
application_id – ID of the application.
command_id – ID of the command to edit.
name – Name of the command.
description – Description of the command.
options – Options of the command.
default_permission – Whether the command is enabled as a default.
guild_id – ID of the guild. Set to None for global.
- delete_application_command(application_id, command_id, guild_id=None)
Sends delete global or guild application command request.
- Parameters
application_id – ID of the application.
command_id – ID of the command to request.
guild_id – ID of the guild. Set to None for global.
- bulk_overwrite_application_commands(application_id, commands, guild_id=None)
Sends delete global or guild application command request.
- Parameters
application_id – ID of the application.
commands – List of commands to overwrite.
guild_id – ID of the guild. Set to None for global.
- create_interaction_response(interaction_id, interaction_token, interaction_response)
Sends create interaction response request.
- Parameters
interaction_id – ID of the interaction.
interaction_token – Token of the interaction.
interaction_response – Interaction Response as dict.
- request_interaction_response(application_id, interaction_token, message_id='@original')
Sends get original interaction response request.
- Parameters
application_id – ID of the application.
interaction_token – Token of the interaction.
message_id – ID of the message to request.
- create_followup_message(application_id, interaction_token, content=None, username=None, avatar_url=None, tts=False, files=None, embeds=None, allowed_mentions=None, components=None, attachments=None, flags=None)
Sends create followup message request.
- Parameters
application_id – ID of the application.
interaction_token – Token of the interaction.
content – Content of the message.
username – Name of the webhook.
avatar_url – URL of the avatar image.
tts – Whether this message is TTS.
files – Files of the message.
embeds – List of embeds of the message.
allowed_mentions – Allowed mentions of the message.
components – Components of the message.
attachments – List of attachment objects.
flags – Flags of the message.
- edit_interaction_response(application_id, interaction_token, message_id='@original', content=Empty, embeds=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)
Sends edit interaction response request.
- Parameters
application_id – ID of the application.
interaction_token – Token of the interaction.
message_id – ID of the message to edit.
content – Content of the message.
embeds – List of embed of the message.
files – Files of the message.
allowed_mentions – Allowed mentions of the message.
attachments – Attachments to keep.
components – Components of the message.
- property edit_followup_message
Sends edit followup message request. Actually an alias of
edit_interaction_response().
- delete_interaction_response(application_id, interaction_token, message_id='@original')
Sends delete interaction response request.
- Parameters
application_id – ID of the application.
interaction_token – Token of the interaction.
message_id – ID of the message to delete.
- request_guild_application_command_permissions(application_id, guild_id)
Sends get guild application command permissions request.
- Parameters
application_id – ID of the application.
guild_id – ID of the guild.
- request_application_command_permissions(application_id, guild_id, command_id)
Sends get application command permissions request.
- Parameters
application_id – ID of the application.
guild_id – ID of the guild.
command_id – ID of the command to get.
- edit_application_command_permissions(application_id, guild_id, command_id, permissions)
Sends edit application command permissions request.
- Parameters
application_id – ID of the application.
guild_id – ID of the guild.
command_id – ID of the command to edit.
permissions – List of permissions to edit
- Returns
- batch_edit_application_command_permissions(application_id, guild_id, permissions)
Sends batch edit application command permissions request.
- Parameters
application_id – ID of the application.
guild_id – ID of the guild.
permissions – List of dict of command ID and permissions to edit
- Returns
- request_current_bot_application_information()
Sends get current bot application information request.
- request_gateway(bot=True)
Sends get gateway request.
- Parameters
bot – Whether it should be bot.
- abstract download(url)
Downloads file from passed url.
- Parameters
url – URL to download.
- abstract classmethod create(token, *args, **kwargs)
Creates new HTTP request client.
- Parameters
token – Token of the bot.
args – Extra optional args.
kwargs – Extra optional keyword args.
- Returns
Initialized object.