dico.api module
- class dico.api.APIClient(token, *, base, default_allowed_mentions=None, application_id=None, **http_options)
Bases:
objectREST API handling client.
Example:
import dico # For request-based: api = dico.APIClient("TOKEN", base=dico.HTTPRequest) # For aiohttp-based: api = dico.APIClient("TOKEN", base=dico.AsyncHTTPRequest) ...
Note
Most of the object parameters accept Snowflake or int or str. For example, you may pass
832488750034190378in Message type.- Parameters:
token (str) – Token of the client.
base (Type[HTTPRequestBase]) – HTTP request handler to use. Must inherit
HTTPRequestBase.default_allowed_mentions (Optional[AllowedMentions]) – Default allowed mentions object to use. Default None.
application_id (Optional[Snowflake]) – ID of the application. Required if you use interactions.
http_options – Options of HTTP request handler.
- Variables:
~.http (HTTPRequestBase) – HTTP request client.
~.default_allowed_mentions (Optional[AllowedMentions]) – Default allowed mentions object of the API client.
~.application (Optional[Application]) – Application object of the client.
~.application_id (Optional[Snowflake]) – ID of the application. Can be
None, and if it is, you must pass parameter application_id for all methods that requires it.
- request_application_role_connection_metadata_records(application)
- update_application_role_connection_metadata_records(application, data)
- request_guild_audit_log(guild, *, user=None, action_type=None, before=None, limit=None)
Requests guild audit log.
- Parameters:
guild – Guild to request audit log.
user – Moderator who did the action. Default all.
action_type (Optional[AuditLogEvents]) – Type of the audit log to get.
before – Entry object to get before. Can be any object which includes ID.
limit (Optional[int]) – Limit of the number of the audit logs to get.
- Returns:
- list_auto_moderation_rule_for_guild(guild)
- request_auto_moderation_rule(guild, auto_moderation_rule_id)
- create_auto_moderation_rule(guild, name, event_type, trigger_type, actions, trigger_metadata=None, enabled=None, exempt_roles=None, exempt_channels=None, reason=None)
- modify_auto_moderation_rule(guild, auto_moderation_rule_id, name=None, event_type=None, trigger_metadata=None, actions=None, enabled=None, exempt_roles=None, exempt_channels=None, reason=None)
- delete_auto_moderation_rule(guild, auto_moderation_rule_id)
- request_channel(channel)
Requests channel object.
- Parameters:
channel – Channel to get.
- Returns:
- modify_guild_channel(channel, *, 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=Empty, rtc_region=Empty, video_quality_mode=Empty, reason=None)
Modifies guild channel.
Note
All keyword-only arguments except name, channel_type, and reason accept None.
- Parameters:
channel – Channel to edit.
name (Optional[str]) – Name of the channel to change.
channel_type (Optional[ChannelTypes]) – Type of the channel to change.
position (Optional[int]) – Position of the channel to change.
topic (Optional[str]) – Topic of the channel to change.
nsfw (Optional[bool]) – Whether this channel is NSFW.
rate_limit_per_user (Optional[int]) – Slowmode of the channel to change.
bitrate (Optional[int]) – Bitrate of the channel to change.
user_limit (Optional[int]) – User limit of the channel to change.
permission_overwrites (Optional[List[Overwrite]]) – List of permission overwrites to change.
parent – Parent category of the channel to change.
rtc_region (Optional[str]) – RTC region of the channel to change. Pass None to set to automatic.
video_quality_mode (Optional[VideoQualityModes]) – Video quality mode of the camera to change.
reason (Optional[str]) – Reason of the action.
- Returns:
- modify_group_dm_channel(channel, *, name=None, icon=None, reason=None)
Modifies group DM channel.
- modify_thread_channel(channel, *, name=None, archived=None, auto_archive_duration=None, locked=None, rate_limit_per_user=Empty, reason=None)
Modifies thread channel.
- Parameters:
channel – Thread channel to modify.
name (Optional[str]) – Name to change.
archived – Whether this thread is archived.
auto_archive_duration (Optional[int]) – Auto archive duration to set.
locked (Optional[bool]) – Whether this thread is locked.
rate_limit_per_user (Optional[int]) – Slowmode time to change. Set to None to remove.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_channel(channel, *, reason=None)
Deletes channel.
- request_channel_messages(channel, *, around=None, before=None, after=None, limit=None)
Requests list of messages in the channel.
- request_channel_message(channel, message)
Requests message from channel.
- Parameters:
channel – Channel to request message.
message – Message to request.
- Returns:
- create_message(channel, content=None, *, embed=None, embeds=None, file=None, files=None, tts=False, allowed_mentions=None, message_reference=None, component=None, components=None, sticker=None, stickers=None)
Creates message to channel.
Note
FileIO object passed to
fileorfilesparameter will be automatically closed when requesting, therefore it is recommended to pass file path.
Warning
You must pass at least one of
contentorembedorfileorfilesparameter.You can’t use
fileandfilesat the same time.
- Parameters:
channel – Channel to create message.
content (Optional[str]) – Content of the message.
embed (Optional[Union[Embed, dict]]) – Embed of the message.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds of the message.
file (Optional[Union[io.FileIO, pathlib.Path, str]]) – File of the message.
files (Optional[List[Union[io.FileIO, pathlib.Path, str]]]) – Files of the message.
tts (Optional[bool]) – Whether to speak message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) –
AllowedMentionsto use for this request.message_reference (Optional[Union[Message, MessageReference, dict]]) – Message to reply.
component (Optional[Union[dict, Component]]) – Component of the message.
components (Optional[List[Union[dict, Component]]]) – List of components of the message.
sticker (Optional[Sticker]) – Sticker of the message.
stickers (Optional[List[Sticker]]) – Stickers of the message. Up to 3.
- Returns:
- crosspost_message(channel, message)
Crossposts message.
- Parameters:
channel – Channel of the message to crosspost.
message – Message to crosspost.
- Returns:
Message
- create_reaction(channel, message, emoji)
Creates reaction to the message.
- delete_reaction(channel, message, emoji, user='@me')
Deletes reaction of the message.
- request_reactions(channel, message, emoji, after=None, limit=None)
Requests list of users reacted to the message.
- delete_all_reactions(channel, message)
Deletes all reactions of the message.
- Parameters:
channel – Channel of the message to delete all reactions.
message – Message to delete all reactions.
- delete_all_reactions_emoji(channel, message, emoji)
Deletes all reactions of the selected emoji.
- edit_message(channel, message, *, content=Empty, embed=Empty, embeds=Empty, file=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, component=Empty, components=Empty)
Edits message.
Note
All keyword arguments are can be both optional and
None. PassingNonewill remove the related item, and not passing will keep it as original state.- Parameters:
channel – Channel of the message to edit.
message – Message to edit.
content (Optional[str]) – Content to edit.
embeds (Optional[List[Union[Embed, dict]]]) – Embeds to edit.
file (Optional[FILE_TYPE]) – File to add.
files (Optional[List[FILE_TYPE]]) – Files to add.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions of the message.
attachments (Optional[List[Union[Attachment, dict]]]) – Attachments to keep.
component (Optional[Union[dict, Component]]) – Component of the message to edit.
components (Optional[List[Union[dict, Component]]]) – Components of the message to edit.
- Returns:
- delete_message(channel, message, *, reason=None)
Deletes message.
- Parameters:
channel – Channel of the message to delete.
message – Message to delete.
reason (Optional[str]) – Reason of the action.
- bulk_delete_messages(channel, *messages, reason=None)
Bulk deletes messages.
- Parameters:
channel – Channel of the messages to delete.
messages – Messages to delete.
reason (Optional[str]) – Reason of the action.
- edit_channel_permissions(channel, overwrite, *, reason=None)
Edits channel permissions.
- request_channel_invites(channel)
Requests channel invites.
- Parameters:
channel – Channel to request invites.
- Returns:
- create_channel_invite(channel, *, max_age=None, max_uses=None, temporary=None, unique=None, target_type=None, target_user=None, target_application=None, reason=None)
Creates channel invite.
- Parameters:
channel – Channel to request invite.
max_age (Optional[int]) – Maximum age of the invite.
max_uses (Optional[int]) – Maximum use count of the invite.
temporary (Optional[bool]) – Whether this invite is temporary, meaning user will be kicked if role is not added.
unique (Optional[bool]) – Whether this invite is unique, meaning new code will be generated even if there is invite with same options.
target_type (Optional[Union[int, InviteTargetTypes]]) – Target type of the voice channel invite.
target_user – Target user of the invite.
target_application – Target application of the invite.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_channel_permission(channel, overwrite, *, reason=None)
Deletes channel permission.
- Parameters:
channel – Channel to delete permission.
overwrite – Target overwrite to delete. Accepts ID of the user or role.
reason (Optional[str]) – Reason of the action.
- follow_news_channel(channel, target_channel)
Follows news channel to target channel.
- Parameters:
channel – Channel to follow.
target_channel – Channel to receive published messages.
- Returns:
- trigger_typing_indicator(channel)
Triggers
<client> is typing...on channel.- Parameters:
channel – Channel to trigger typing.
- request_pinned_messages(channel)
Requests pinned messages of the channel.
- Parameters:
channel – Channel to request pinned messages.
- Returns:
List[
Message]
- pin_message(channel, message, *, reason=None)
Pins message to the channel.
- Parameters:
channel – Channel to pin message.
message – Message to pin.
reason (Optional[str]) – Reason of the action.
- unpin_message(channel, message, *, reason=None)
Unpins message from the channel.
- Parameters:
channel – Channel to unpin the message.
message – Message to unpin.
reason (Optional[str]) – Reason of the action.
- group_dm_add_recipient(channel, user, access_token, nick)
Adds recipient to the group DM.
- group_dm_remove_recipient(channel, user)
Removes recipient to the group DM.
- Parameters:
channel – Group DM channel to remove recipient.
user – Recipient to remove.
- start_thread(channel, message=None, *, name, auto_archive_duration=None, rate_limit_per_user=Empty, thread_type=None, invitable=None, reason=None)
Starts new thread.
Note
If
messageparam is passed, type of thread will be always public regardless of what you’ve set to.- Parameters:
channel – Channel to create thread.
message – Message to create thread from.
name (str) – Name of the thread.
auto_archive_duration (int) – When to archive thread in minutes.
rate_limit_per_user –
thread_type (Union[ChannelTypes, int]) – Type of thread.
invitable (bool) – Whether this thread can be invitable.
reason (Optional[str]) – Reason of the action.
- Returns:
- start_thread_in_forum_channel(channel, name, message, auto_archive_duration=None, rate_limit_per_user=Empty, applied_tags=None, *, reason=None)
- join_thread(channel)
Joins to thread.
- Parameters:
channel – Thread to join.
- add_thread_member(channel, user)
Adds member to thread.
- Parameters:
channel – Thread to add member.
user – User to add.
- leave_thread(channel)
Leaves thread.
- Parameters:
channel – Thread to leave.
- remove_thread_member(channel, user)
Removes member from thread.
- Parameters:
channel – Thread to remove member.
user – User to remove.
- list_thread_members(channel)
Lists members of thread.
- Parameters:
channel – Thread to list members.
- Returns:
List[
ThreadMember]
- list_public_archived_threads(channel, *, before=None, limit=None)
Lists threads in channel that is archived and public.
- Parameters:
channel – Channel to list threads.
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- list_private_archived_threads(channel, *, before=None, limit=None)
Lists threads in channel that is archived and private.
- Parameters:
channel – Channel to list threads.
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- list_joined_private_archived_threads(channel, *, before=None, limit=None)
Lists threads in channel that is archived and private and joined.
- Parameters:
channel – Channel to list threads.
before (Optional[Union[str, datetime.datetime]]) – Timestamp to show threads before.
limit (Optional[int]) – Limit of the number of the threads.
- Returns:
- list_guild_emojis(guild)
Lists emojis of the guild.
- Parameters:
guild – Guild to list emojis.
- Returns:
List[
Emoji]
- request_guild_emoji(guild, emoji)
Requests emoji from guild.
- Parameters:
guild – Guild to request emoji.
emoji – Emoji to request.
- Returns:
- create_guild_emoji(guild, *, name, image, roles=None, reason=None)
Creates emoji from guild.
- modify_guild_emoji(guild, emoji, *, name=Empty, roles=Empty, reason=None)
Modifies emoji of the guild.
- delete_guild_emoji(guild, emoji, reason=None)
Deletes emoji of the guild.
- Parameters:
guild – Guild to delete emoji.
emoji – Emoji to delete.
reason (Optional[str]) – 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)
Creates guild.
Note
You can create image data for
iconusingutils.to_image_data().- Parameters:
name (str) – Name of the guild.
icon (Optional[str]) – Icon of the guild.
verification_level (Optional[Union[int, VerificationLevel]]) – Verification level of the guild.
default_message_notifications (Optional[Union[int, DefaultMessageNotificationLevel]]) – Default notifications level of the guild.
explicit_content_filter (Optional[Union[int, ExplicitContentFilterLevel]]) – Default explicit content filter level of the guild.
roles (Optional[List[dict]]) – Roles of the guild.
channels (Optional[List[dict]]) – Channels of the guild.
afk_channel_id – Temporary ID of the afk channel.
afk_timeout (Optional[int]) – Timeout of the afk channel.
system_channel_id – Temporary ID of the system channel.
system_channel_flags (Optional[Union[int, SystemChannelFlags]]) – Flags of the system channel.
- Returns:
- request_guild(guild, with_counts=False)
Requests guild.
- Parameters:
guild – Guild to request.
with_counts – Whether to include member count and presence count.
- Returns:
- request_guild_preview(guild)
Requests guild preview.
- Parameters:
guild – Guild to request preview.
- Returns:
- modify_guild(guild, *, name=None, verification_level=Empty, default_message_notifications=Empty, explicit_content_filter=Empty, afk_channel=Empty, afk_timeout=None, icon=Empty, owner=None, splash=Empty, discovery_splash=Empty, banner=Empty, system_channel=Empty, system_channel_flags=None, rules_channel=Empty, public_updates_channel=Empty, preferred_locale=Empty, features=None, description=Empty, reason=None)
Modifies guild.
Note
You can create image data for
icon,splash,discovery_splash, andbannerusingutils.to_image_data().- Parameters:
guild – Guild to modify.
name (Optional[str]) – Name of the guild.
verification_level (Optional[Union[int, VerificationLevel]]) – Verification level of the guild.
default_message_notifications (Optional[Union[int, DefaultMessageNotificationLevel]]) – Default notifications level of the guild.
explicit_content_filter (Optional[Union[int, ExplicitContentFilterLevel]]) – Default explicit content filter level of the guild.
afk_channel – AFK channel of the guild.
afk_timeout (Optional[int]) – Timeout of the AFK channel.
icon (Optional[str]) – Icon of the guild.
owner – Owner of the guild.
splash (Optional[str]) – Splash image of the guild.
discovery_splash (Optional[str]) – Discovery splash image of the guild.
banner (Optional[str]) – Banner of the guild.
system_channel – System channel of the guild.
system_channel_flags (Optional[Union[int, SystemChannelFlags]]) – Flags of the system channel.
rules_channel – Rules channel of the guild.
public_updates_channel – Public update channel of the guild.
preferred_locale (Optional[str]) – Preferred locale of the guild.
features (Optional[List[str]]) – Features of the guild.
description (Optional[str]) – Description of the guild.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_guild(guild)
Deletes guild. Client must be an owner to delete.
- Parameters:
guild – Guild to delete.
- request_guild_channels(guild)
Requests channels of the guild.
- Parameters:
guild – Guild to request channels.
- Returns:
List[
Channel]
- create_guild_channel(guild, name, *, channel_type=None, topic=None, bitrate=None, user_limit=None, rate_limit_per_user=None, position=None, permission_overwrites=None, parent=None, nsfw=None, reason=None)
Creates channel in guild.
- Parameters:
guild – Guild to create channel.
name (str) – Name of the channel.
channel_type (Optional[Union[int, ChannelTypes]]) – Type of the channel.
topic (Optional[str]) – Topic of the channel.
bitrate (Optional[int]) – Bitrate of the channel.
user_limit – User limit of the channel.
rate_limit_per_user (Optional[int]) – Slowmode of the channel.
position (Optional[int]) – Position of the channel.
permission_overwrites (Optional[Union[dict, Overwrite]]) – Permission overwrites of the channel.
parent – Parent category of the channel.
nsfw (Optional[bool]) – Whether this channel is NSFW.
reason (Optional[str]) – Reason of the action.
- Returns:
- modify_guild_channel_positions(guild, *params, reason=None)
Modifies position of the guild channels.
- Parameters:
guild – Guild to edit channel positions.
params – Positions of the channel. Use
to_position_param().reason (Optional[str]) – Reason of the action.
- list_active_threads(guild)
Lists active threads in guild.
- Parameters:
guild – Guild to get active threads.
- Returns:
- request_guild_member(guild, user)
Requests member of the guild.
- Parameters:
guild – Guild to request member
user – Member to request.
- Returns:
- list_guild_members(guild, limit=None, after=None)
Lists members of the guild.
- Parameters:
guild – Guild to list members.
limit (Optional[int]) – Limit of the count of the members.
after – Member ID to list after.
- Returns:
List[
GuildMember]
- search_guild_members(guild, query, limit=None)
Searches members of the guild using query given. This will search for member nickname or username that starts with query.
- Parameters:
- Returns:
List[
GuildMember]
- add_guild_member(guild, user, access_token, nick=None, roles=None, mute=None, deaf=None)
Adds member to guild. Requires OAuth2 access token with
guilds.joinscope.- Parameters:
guild – Guild to add member.
user – User that will be added.
access_token (str) – OAuth2 access token with
guilds.joinscope.nick (Optional[str]) – Nickname of the member.
roles – Roles of the member.
mute (Optional[bool]) – Whether this member is muted in voice channels.
deaf (Optional[bool]) – Whether this member is deafened in voice channels.
- Returns:
- modify_guild_member(guild, user, *, nick=Empty, roles=Empty, mute=Empty, deaf=Empty, channel=Empty, communication_disabled_until=Empty, reason=None)
Modifies guild member.
- Parameters:
guild – Guild of the member to modify.
user – Member to modify
nick (Optional[str]) – Nickname to modify.
roles – Roles to modify.
mute (Optional[bool]) – Whether this member is muted.
deaf (Optional[bool]) – Whether this member is deafen.
channel – Channel to move user to.
communication_disabled_until (Optional[Union[datetime.datetime, str]]) – When user’s timeout will be expired. Set None to remove.
reason (Optional[str]) – Reason of the action.
- Returns:
- modify_current_user_nick(guild, nick=Empty, *, reason=None)
Modifies nickname of the current client user.
- add_guild_member_role(guild, user, role, *, reason=None)
Adds role to guild member.
- Parameters:
guild – Guild of the member.
user – Member to add role.
role – Role to add.
reason (Optional[str]) – Reason of the action.
- remove_guild_member_role(guild, user, role, *, reason=None)
Removes role of the guild member.
- Parameters:
guild – Guild to remove member’s role.
user – Member to remove role.
role – Role to remove.
reason (Optional[str]) – Reason of the action.
- remove_guild_member(guild, user)
Removes guild member.
- Parameters:
guild – Guild to remove member.
user – Member to remove.
- property kick
Alias of
remove_guild_member().
- request_guild_bans(guild)
Requests bans of the guild.
- Parameters:
guild – Guild to request bans.
- Returns:
List[
Ban]
- request_guild_ban(guild, user)
Requests ban of the user in the guild.
- Parameters:
guild – Guild to request ban.
user – User to request ban of.
- Returns:
- create_guild_ban(guild, user, *, delete_message_days=None, reason=None)
Creates guild ban.
- property ban
Alias of
create_guild_ban().
- remove_guild_ban(guild, user, *, reason=None)
Removes guild ban.
- Parameters:
guild – Guild to remove ban.
user – User to remove ban.
reason (Optional[str]) – Reason of the action.
- request_guild_roles(guild)
Requests roles of the guild.
- Parameters:
guild – Guild to request roles.
- Returns:
List[
Role]
- create_guild_role(guild, *, name=None, permissions=None, color=None, hoist=None, mentionable=None, reason=None)
Creates role in the guild.
- Parameters:
guild – Guild to create role.
name (Optional[str]) – Name of the role.
permissions (Optional[Union[int, str, PermissionFlags]]) – Permissions this role will have.
color (Optional[int]) – Color of the role.
hoist (Optional[bool]) – Whether this role is hoist.
mentionable (Optional[bool]) – Whether this role is mentionable.
reason (Optional[str]) – Reason of the action.
- Returns:
- modify_guild_role_positions(guild, *params, reason=None)
Modifies positions of the guild role.
- Parameters:
guild – Guild to modify positions of the role.
params (dict) – Position data to modify. You should use
to_position_param().reason (Optional[str]) – Reason of the action.
- Returns:
List[
Role]
- modify_guild_role(guild, role, *, name=Empty, permissions=Empty, color=Empty, hoist=Empty, mentionable=Empty, reason=None)
Modifies role of the guild.
- Parameters:
guild – Guild to modify role.
role – Role to modify.
name (Optional[str]) – Name of the role to modify.
permissions (Optional[Union[int, str, PermissionFlags]]) – Permissions of the role to modify.
color (Optional[int]) – Color of the role to modify.
hoist (Optional[bool]) – Whether this role is hoist.
mentionable (Optional[bool]) – Whether this role is mentionable.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_guild_role(guild, role, *, reason=None)
Deletes guild role.
- Parameters:
guild – Guild to delete role.
role – Role to delete.
reason (Optional[str]) – Reason of the action.
- request_guild_prune_count(guild, *, days=None, include_roles=None)
Requests guild prune count.
- Parameters:
guild – Guild to request prune count.
days (Optional[int]) – Days to count prune.
include_roles – Roles to include.
- Returns:
Calculated prune count.
- begin_guild_prune(guild, *, days=None, compute_prune_count=None, include_roles=None, reason=None)
Begins guild prune.
- request_guild_voice_regions(guild)
Requests list of guild voice regions.
- Parameters:
guild – Guild to request voice regions.
- Returns:
List[
VoiceRegion]
- request_guild_invites(guild)
Requests list of guild invites.
- Parameters:
guild – Guild to request invites.
- Returns:
List[
Invite]
- request_guild_integrations(guild)
Requests list of guild integrations.
- Parameters:
guild – Guild to request integrations.
- Returns:
List[
Integration]
- delete_guild_integration(guild, integration, *, reason=None)
Deletes guild integration.
- Parameters:
guild – Guild to delete integration.
integration – Integration to delete.
reason (Optional[str]) – Reason of the action.
- request_guild_widget_settings(guild)
Requests guild widget settings.
- Parameters:
guild – Guild to request widget settings.
- Returns:
- modify_guild_widget(guild, *, enabled=None, channel=Empty, reason=None)
Modifies guild widget.
- Parameters:
- Returns:
- request_guild_widget(guild)
Request guild’s widget.
- Parameters:
guild – Guild to request widget.
- Returns:
Refer https://discord.com/developers/docs/resources/guild#get-guild-widget.
- request_guild_vanity_url(guild)
Requests guild vanity URL.
- Parameters:
guild – Guild to request guild vanity URL.
- Returns:
Refer https://discord.com/developers/docs/resources/guild#get-guild-vanity-url.
- request_guild_widget_image(guild, style=None)
Requests guild widget image.
- Parameters:
guild – Guild to request widget image.
style (Optional[str]) – Style of the widget. One of “shield”, “banner1”, “banner2”, “banner3”, and “banner4”.
- Returns:
bytes
- request_guild_welcome_screen(guild)
Requests guild welcome screen.
- Parameters:
guild – Guild to request welcome screen.
- Returns:
- modify_guild_welcome_screen(guild, *, enabled=Empty, welcome_channels=Empty, description=Empty, reason=None)
Modifies guild welcome screen.
- Parameters:
guild – Guild to modify welcome screen.
enabled (Optional[bool]) – Whether welcome screen is enabled.
welcome_channels (Optional[List[Union[WelcomeScreenChannel, dict]]]) – Welcome channels to show. You can use
to_welcome_screen_channel().description (Optional[str]) – Description of the welcome screen.
reason (Optional[str]) – Reason of the action.
- Returns:
- request_guild_onboarding(guild)
- modify_guild_onboarding(guild, prompts, default_channels, enabled, mode, reason=None)
- modify_user_voice_state(guild, channel, user='@me', *, suppress=None, request_to_speak_timestamp=None)
Modifies user’s voice state.
- Parameters:
guild – Guild to modify user voice state.
channel – Stage channel user is in.
user – User to modify voice state. Ignore this parameter or pass
"@me"to modify current user.suppress – Whether to toggle suppress status.
request_to_speak_timestamp – Requests to speak. Time can be present or future.
- list_scheduled_events_for_guild(guild, with_user_count=None)
Lists scheduled events for guild.
- Parameters:
guild – Guild to list scheduled events.
with_user_count (Optional[bool]) – Whether to include user count in response.
- Returns:
List[
GuildScheduledEvent]
- create_guild_scheduled_event(guild, *, channel=None, entity_metadata=None, name, privacy_level, scheduled_start_time, scheduled_end_time=None, description=None, entity_type)
Creates guild scheduled event.
- Parameters:
guild – Guild to create event.
channel – Channel of the event. Can be optional if entity type is
EXTERNAL.entity_metadata (Optional[Union[dict, GuildScheduledEventEntityMetadata]]) – Metadata of the entity.
name (str) – Name of the event.
privacy_level (Union[int, GuildScheduledEventPrivacyLevel]) – Privacy level of the event.
scheduled_start_time (Union[str, datetime.datetime]) – Scheduled start time of the event.
scheduled_end_time (Union[str, datetime.datetime]) – Scheduled end time of the event.
description (Optional[str]) – Description of the event.
entity_type (Union[int, GuildScheduledEventEntityTypes]) – Type of the entity of the event.
- Returns:
- request_guild_scheduled_event(guild, guild_scheduled_event, with_user_count=None)
Requests guild scheduled event.
- Parameters:
guild – Guild to request event.
guild_scheduled_event – Event to request.
with_user_count (Optional[bool]) – Whether to include user count.
- Returns:
- modify_guild_scheduled_event(guild, guild_scheduled_event, *, channel=Empty, entity_metadata=None, name=None, privacy_level=None, scheduled_start_time=None, scheduled_end_time=None, description=None, entity_type=None, status=None)
Modifies guild scheduled event.
- Parameters:
guild – Guild to modify event.
guild_scheduled_event – Event to modify.
channel – Channel of the event. Set to
Noneif you are changing event toEXTERNAL.entity_metadata (Optional[Union[dict, GuildScheduledEventEntityMetadata]]) – Metadata of the entity.
name (Optional[str]) – Name of the event.
privacy_level (Optional[Union[int, GuildScheduledEventPrivacyLevel]]) – Privacy level of the event.
scheduled_start_time (Optional[Union[str, datetime.datetime]]) – Scheduled start time of the event.
scheduled_end_time (Optional[Union[str, datetime.datetime]]) – Scheduled end time of the event.
description (Optional[str]) – Description of the event.
entity_type (Optional[Union[int, GuildScheduledEventEntityTypes]]) – Type of the entity of the event.
status (Optional[Union[int, GuildScheduledEventStatus]]) – Status of the event.
- Returns:
- delete_guild_scheduled_event(guild, guild_scheduled_event)
Deletes guild scheduled event.
- Parameters:
guild – Guild to delete event.
guild_scheduled_event – Event to delete.
- request_guild_scheduled_event_users(guild, guild_scheduled_event, limit=None, with_member=None, before=None, after=None)
Requests guild scheduled event users.
- Parameters:
- Returns:
List[
GuildScheduledEventUser]
- request_guild_template(template)
Requests guild template.
- Parameters:
template (Union[str, GuildTemplate]) – Template to request. Must be code or guild template object.
- Returns:
- create_guild_from_template(template, name, *, icon=None)
Creates guild from template.
- Parameters:
template (Union[str, GuildTemplate]) – Template to use. Must be code or guild template object.
name (str) – Name of the guild.
icon (Optional[str]) – Icon of the guild. Use
utils.to_image_data().
- Returns:
- request_guild_templates(guild)
Requests guild’s all templates.
- Parameters:
guild – Guild to request templates.
- Returns:
List[
GuildTemplate]
- create_guild_template(guild, name, *, description=Empty)
Creates template from guild.
- Parameters:
- Returns:
- sync_guild_template(guild, template)
Syncs guild template.
- Parameters:
guild – Guild to sync template.
template (Union[str, GuildTemplate]) – Template to sync. Must be code or guild template object.
- Returns:
- modify_guild_template(guild, template, name=None, description=Empty)
Modifies guild template.
- Parameters:
guild – Guild to modify template.
template (Union[str, GuildTemplate]) – Template to modify. Must be code or guild template object.
name (Optional[str]) – Name of the template to modify.
description (Optional[str]) – Description of the template to modify.
- Returns:
- delete_guild_template(guild, template)
Deletes guild template.
- Parameters:
guild – Guild to delete template.
template (Union[str, GuildTemplate]) – Template to delete. Must be code or guild template object.
- Returns:
- request_invite(invite_code, *, with_counts=None, with_expiration=None)
Requests invite.
- delete_invite(invite_code, *, reason=None)
Deletes invite.
- create_stage_instance(channel, topic, privacy_level=None, *, reason=None)
Creates stage instance.
- Parameters:
channel – Stage channel to create instance.
topic (str) – Topic of the instance.
privacy_level (Optional[Union[int, PrivacyLevel]]) – Privacy level to set.
reason (Optional[str]) – Reason of the action.
- Returns:
- request_stage_instance(channel)
Requests stage instance.
- Parameters:
channel – Stage channel to request instance.
- Returns:
- modify_stage_instance(channel, topic=None, privacy_level=None, *, reason=None)
Modifies stage instance.
- Parameters:
channel – Stage channel to modify instance.
topic (Optional[str]) – Topic of the instance to change.
privacy_level (Optional[Union[int, PrivacyLevel]]) – Privacy level to change.
reason (Optional[str]) – Reason of the action.
- Returns:
- delete_stage_instance(channel, *, reason=None)
Deletes stage instance.
- Parameters:
channel – Stage channel to delete instance.
reason (Optional[str]) – Reason of the action.
- request_sticker(sticker)
Requests sticker.
- Parameters:
sticker – Sticker to request.
- Returns:
- list_nitro_sticker_packs()
Lists nitro sticker packs.
- Returns:
- list_guild_stickers(guild)
Lists guild stickers.
- Parameters:
guild – Guild to list stickers.
- Returns:
List[
Sticker]
- request_guild_sticker(guild, sticker)
Requests guild sticker.
- Parameters:
guild – Guild to request sticker.
sticker – Sticker to request.
- Returns:
- create_guild_sticker(guild, *, name, description, tags, file, reason=None)
Creates guild sticker.
- modify_guild_sticker(guild, sticker, *, name=None, description=Empty, tags=None, reason=None)
Modifies guild sticker.
- Parameters:
- Returns:
- delete_guild_sticker(guild, sticker, *, reason=None)
Deletes guild sticker.
- Parameters:
guild – Guild to delete sticker.
sticker – Sticker to delete.
reason (Optional[str]) – Reason of the action.
- request_user(user='@me')
Requests user.
- Parameters:
user – User to request. Defaults to current user.
- Returns:
- modify_current_user(username=None, avatar=Empty)
Modifies current user.
- leave_guild(guild)
Leaves guild.
- Parameters:
guild – Guild to leave.
- create_dm(recipient)
Creates direct message channel.
- Parameters:
recipient – Recipient of the direct message.
- Returns:
- create_group_dm(access_tokens, nicks)
Creates group direct message channel.
- request_user_connections()
- request_user_application_role_connections(application)
- update_user_application_role_connections(application, platform_name=None, platform_username=None, metadata=None)
- list_voice_regions()
Lists voice regions.
- Returns:
List[
VoiceRegion]
- create_webhook(channel, *, name=None, avatar=None)
Creates webhook.
- request_channel_webhooks(channel)
Requests channel webhooks.
- Parameters:
channel – Channel to request webhooks from.
- Returns:
List[
Webhook]
- request_guild_webhooks(guild)
Requests guild webhooks.
- Parameters:
guild – Guild to request webhooks from.
- Returns:
List[
Webhook]
- request_webhook(webhook, webhook_token=None)
Requests webhook.
- modify_webhook(webhook, *, webhook_token=None, name=None, avatar=None, channel=None)
Modifies webhook.
- Parameters:
- Returns:
- delete_webhook(webhook, webhook_token=None)
Deletes webhook.
- execute_webhook(webhook, *, webhook_token=None, wait=None, thread=None, content=None, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None, allowed_mentions=None, components=None)
Executes webhook.
- Parameters:
webhook – Webhook to execute.
webhook_token (Optional[str]) – Token of the webhook, if
webhookparameter is not aWebhookinstance.wait (Optional[bool]) – Whether to wait for the message to be created.
thread – Thread channel to send the message in.
content (Optional[str]) – Content of the message.
username (Optional[str]) – Username of the message.
avatar_url (Optional[str]) – Avatar of the message.
tts (Optional[bool]) – Whether the message should be TTS.
file (Optional[FILE_TYPE]) – File to send with the message.
files (Optional[List[FILE_TYPE]]) – List of files to send with the message.
embed (Optional[Union[Embed, dict]]) – Embed to send with the message.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds to send with the message.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions of the message.
components (Optional[List[Union[dict, Component]]]) – List of components to send with the message.
- Returns:
- request_webhook_message(webhook, message, *, webhook_token=None)
Requests webhook message.
- edit_webhook_message(webhook, message, *, webhook_token=None, content=Empty, embed=Empty, embeds=Empty, file=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, component=Empty, components=Empty)
Edits webhook message.
- Parameters:
webhook – Webhook to edit message.
message – Message to edit.
webhook_token (Optional[str]) – Token of the webhook, if
webhookparameter is not aWebhookinstance.content (Optional[str]) – Content of the message to edit.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds to edit.
file (Optional[FILE_TYPE]) – File to edit.
files (Optional[List[FILE_TYPE]]) – List of files to edit.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions to edit.
attachments (Optional[List[Union[Attachment, dict]]]) – List of attachments to edit.
component (Optional[Union[dict, Component]]) – Component to edit.
components (Optional[List[Union[dict, Component]]]) – List of components to edit.
- Returns:
- delete_webhook_message(webhook, message, *, webhook_token=None)
Delete a message from a webhook.
- request_application_commands(guild=None, *, application_id=None)
Request application commands.
- Parameters:
guild – Guild to request commands from. Default global commands.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
List[
ApplicationCommand]
- create_application_command(guild=None, *, name, description=None, options=None, default_permission=None, command_type=None, application_id=None)
Creates application command.
- Parameters:
guild – Guild to create command in. Default global command.
name (str) – Name of the command.
description (Optional[str]) – Description of the command.
options (Optional[List[Union[
ApplicationCommandOption, dict]]]) – List of command options.default_permission (Optional[bool]) – Whether default permission is enabled or not.
command_type (Optional[Union[
ApplicationCommandTypes, int]]) – Type of the command.application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- request_application_command(command, *, guild=None, application_id=None)
Requests application command.
- Parameters:
command – Command to request.
guild – Guild to request command from, if command is guild’s.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- edit_application_command(command, *, name=None, description=None, options=None, default_permission=None, guild=None, application_id=None)
Edits application command.
- Parameters:
command – Command to edit.
name (Optional[str]) – Name of the command to edit.
description (Optional[str]) – Description of the command to edit.
options (Optional[List[Union[
ApplicationCommandOption, dict]]]) – List of command options to edit.default_permission (Optional[bool]) – Whether default permission is enabled or not.
guild – Guild to edit command in, if command is guild’s.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- delete_application_command(command, *, guild=None, application_id=None)
Deletes application command.
- Parameters:
command – Command to delete.
guild – Guild to delete command from, if command is guild’s.
application_id – ID of the application, if
application_idis not set on the client.
- bulk_overwrite_application_commands(*commands, guild=None, application_id=None)
Bulk overwrites application commands.
- Parameters:
commands (Union[dict,
ApplicationCommand]) – Commands to overwrite.guild – Guild to overwrite commands in, if commands are guild’s.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
List[
ApplicationCommand]
- create_interaction_response(interaction, interaction_response, *, interaction_token=None)
Creates interaction response.
- Parameters:
interaction – Interaction to create response for.
interaction_response (Union[dict,
InteractionResponse]) – Response of interaction to create.interaction_token (Optional[str]) – Token of the interaction, if parameter
interactionis not an Interaction instance.
- request_interaction_response(interaction=None, message='@original', *, interaction_token=None, application_id=None)
Requests interaction response.
- Parameters:
interaction – Interaction to request response for.
message – Message to request. Defaults to initial response.
interaction_token (Optional[str]) – Token of the interaction, if parameter
interactionis not an Interaction instance.application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- create_followup_message(interaction=None, *, interaction_token=None, application_id=None, content=None, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None, allowed_mentions=None, components=None, ephemeral=False)
Creates followup message.
- Parameters:
interaction – Interaction to create followup message for.
interaction_token (Optional[str]) – Token of the interaction, if parameter
interactionis not an Interaction instance.application_id – ID of the application, if
application_idis not set on the client.content (Optional[str]) – Content of the message.
username (Optional[str]) – Username of the message.
avatar_url (Optional[str]) – Avatar URL of the message.
tts (Optional[bool]) – Whether the message should be TTS.
file (Optional[FILE_TYPE]) – File to send.
files (Optional[List[FILE_TYPE]]) – List of files to send.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds to send.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions of the message.
components (Optional[List[Union[dict, Component]]]) – List of components to send.
ephemeral (Optional[bool]) – Whether the message should be ephemeral.
- Returns:
- edit_interaction_response(interaction=None, message='@original', *, interaction_token=None, application_id=None, content=Empty, file=Empty, files=Empty, embed=Empty, embeds=Empty, allowed_mentions=Empty, attachments=Empty, component=Empty, components=Empty)
Edits interaction response.
- Parameters:
interaction – Interaction to edit response.
message – Message to edit.
interaction_token (Optional[str]) – Token of the interaction, if parameter
interactionis not an Interaction instance.application_id – ID of the application, if
application_idis not set on the client.content (Optional[str]) – Content of the message to edit.
file (Optional[FILE_TYPE]) – File to edit.
files (Optional[List[FILE_TYPE]]) – List of files to edit.
embeds (Optional[List[Union[Embed, dict]]]) – List of embeds to edit.
allowed_mentions (Optional[Union[AllowedMentions, dict]]) – Allowed mentions to edit.
attachments (Optional[List[Union[Attachment, dict]]]) – Attachments to edit.
component (Optional[Union[dict, Component]]) – Component to edit.
components (Optional[List[Union[dict, Component]]]) – List of components to edit.
- Returns:
- property edit_followup_message
Alias of
edit_interaction_response().
- delete_interaction_response(interaction=None, message='@original', *, interaction_token=None, application_id=None)
Deletes interaction response.
- Parameters:
interaction – Interaction to delete response.
message – Message to delete.
interaction_token (Optional[str]) – Token of the interaction, if parameter
interactionis not an Interaction instance.application_id – ID of the application, if
application_idis not set on the client.
- request_guild_application_command_permissions(guild, *, application_id=None)
Requests guild application command permissions.
- Parameters:
guild – Guild to request application command permissions.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- request_application_command_permissions(guild, command, *, application_id=None)
Requests application command permissions.
- Parameters:
guild – Guild to request application command permissions.
command – Command to request permissions.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- edit_application_command_permissions(guild, command, *permissions, application_id=None)
Edits application command permissions.
- Parameters:
guild – Guild to edit application command permissions.
command – Command to edit permissions.
permissions (Union[dict,
GuildApplicationCommandPermissions]) – Permissions to edit.application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- batch_edit_application_command_permissions(guild, permissions_dict, *, application_id=None)
Batch edits application command permissions.
- Parameters:
guild – Guild to edit application command permissions.
permissions_dict – Dict of command: permission.
application_id – ID of the application, if
application_idis not set on the client.
- Returns:
- request_current_bot_application_information()
Requests current bot application information.
- Returns:
- request_gateway(*, bot=True)
Requests gateway.
- Parameters:
bot (bool) – Whether this client is bot. This must be
True.- Returns:
- get_allowed_mentions(allowed_mentions)
Automatically converts allowed_mentions to dict.
- Parameters:
allowed_mentions – Allowed mentions.
- Returns:
dict
- property get
Empty function that may be implemented if cache is present of the client.
- property has_cache
Whether this client supports caching.