HTTP#

HTTP reference#

class nextcore.http.HTTPClient(*, trust_local_time=True, timeout=60, max_rate_limit_retries=10)#

The HTTP client to interface with the Discord API.

Example usage

http_client = HTTPClient()
await http_client.setup()

gateway = await http_client.get_gateway()

print(gateway["url"])

await http_client.close()
Parameters
  • trust_local_time (bool) – Whether to trust local time. If this is not set HTTP rate limiting will be a bit slower but may be a bit more accurate on systems where the local time is off.

  • timeout (float) – The default request timeout in seconds.

  • max_rate_limit_retries (int) – How many times to attempt to retry a request after rate limiting failed.

Return type

None

trust_local_time#

If this is enabled, the rate limiter will use the local time instead of the discord provided time. This may improve your bot’s speed slightly.

Warning

If your time is not correct, and this is set to True, this may result in more rate limits being hit.

You can check if your clock is synchronized by running the following command:

timedatectl

If it is synchronized, it will show “System clock synchronized: yes” and “NTP service: running”

If the system clock is not synchronized but the ntp service is running you will have to wait a few minutes for it to sync.

To enable the ntp service run the following command:

sudo timedatectl set-ntp on

This will automatically sync the system clock every once in a while.

You can check if your clock is synchronized by running the following command:

timedatectl

If it is synchronized, it will show “System clock synchronized: yes” and “NTP service: running”

If the system clock is not synchronized but the ntp service is running you will have to wait a few minutes for it to sync.

To enable the ntp service run the following command:

sudo timedatectl set-ntp on

This will automatically sync the system clock every once in a while.

This can be turned on by going to Settings -> Time & language -> Date & time and turning on Set time automatically.

timeout#

The default request timeout in seconds.

default_headers#

The default headers to pass to every request.

max_retries#

How many times to attempt to retry a request after rate limiting failed.

Note

This does not retry server errors.

rate_limit_storages#

Classes to store rate limit information.

The key here is the rate_limit_key (often a user ID).

dispatcher#

Events from the HTTPClient. See the events

async add_guild_member(bot_authentication, user_authentication, guild_id, user_id, *, nick=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, mute=UndefinedType.UNDEFINED, deaf=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Adds a member to a guild

Read the documentation

Note

The bot requires the CREATE_INSTANT_INVITE permission.

Parameters
  • bot_authentication (BotAuthentication) – The bot to use to invite the user

  • user_authentication (BearerAuthentication) –

    The user to add to the guild.

    Note

    This requires the guilds.join scope.

  • guild_id (Snowflake) – The guild to add the user to

  • user_id (Snowflake) – The user to add to the guild.

  • nick (str | UndefinedType) –

    What to set the users nickname to.

    Note

    Setting this requires the MANAGE_NICKNAMES permission

  • roles (list[Snowflake] | UndefinedType) –

    Roles to assign to the user.

    Note

    Setting this requires the MANAGE_ROLES permission

  • mute (bool | UndefinedType) –

    Whether to server mute the user

    Note

    Setting this requires the MUTE_MEMBERS permission

  • deaf (bool | UndefinedType) –

    Whether to server deafen the user

    Note

    Setting this requires the DEAFEN_MEMBERS permission

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

  • discord_typings.GuildMemberData – The member was added to the guild

  • None – The member was already in the guild

Return type

GuildMemberData | None

async add_guild_member_role(authentication, guild_id, user_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Add a role to a member

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild where the member is located

  • user_id (Snowflake) – The id of the member to add the role to

  • role_id (Snowflake) – The id of the role to add.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async add_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Adds a member to a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to add the member to.

  • user_id (str | int) – The id of the member to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async begin_guild_prune(authentication, guild_id, *, days=UndefinedType.UNDEFINED, compute_prune_count=UndefinedType.UNDEFINED, include_roles=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the amount of members that would be pruned

Read the documentation

Note

This requires the KICK_MEMBERS permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the prune count for

  • days (int | UndefinedType) –

    How many days a user has to be inactive for to get included in the prune count

    Note

    If this is UNDEFINED, this will default to 7.

  • include_roles (list[str] | UndefinedType) – IDs of roles to be pruned aswell as the default role.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • compute_prune_count (bool | UndefinedType) –

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[str, Any]

async bulk_delete_messages(authentication, channel_id, messages, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes multiple messages.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_DELETE_BULK dispatch event.

Warning

This will not delete messages older than two weeks.

If any of the messages provided are older than 2 weeks this will error.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • messages (list[str] | list[int] | list[Snowflake]) –

    The ids of the messages to delete.

    Note

    This has to be between 2 and 100 messages.

    Invalid messages still count towards the limit.

  • reason (str | UndefinedType) –

    The reason for deleting the message.

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async bulk_overwrite_global_application_commands(authentication, application_id, *commands, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a global application command

Read the documentation

Warning

This will replace all your global commands. Include the old commands to keep them

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • commands (ApplicationCommandPayload) –

    The global commands to overwrite the current global commands with

    Note

    Some fields have additional restrictions. See HTTPClient.create_global_application_command()’s arguments for more information.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The global commands

Return type

list[discord_typings.ApplicationCommandData]

async bulk_overwrite_guild_application_commands(authentication, application_id, guild_id, *commands, bucket_priority=0, global_priority=0, wait=True)#

Bulk overwrite guild commands

Read the documentation

Warning

This will replace all your global commands. Include the old commands to keep them

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The guild to overwrite commands in

  • commands (ApplicationCommandPayload) –

    The commands to overwrite the current commands with

    Note

    There is some extra limits. See the params of HTTPClient.edit_guild_application_command() for more info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The new commands

Return type

list[discord_typings.ApplicationCommandData]

async close()#

Clean up internal state

Return type

None

async connect_to_gateway(*, version=UndefinedType.UNDEFINED, encoding=UndefinedType.UNDEFINED, compress=UndefinedType.UNDEFINED)#

Connects to the gateway

Example usage:

ws = await http_client.connect_to_gateway()
Parameters
  • version (Literal[6, 7, 8, 9, 10] | UndefinedType) –

    The major API version to use

    Hint

    It is a good idea to pin this to make sure something doesn’t unexpectedly change

  • encoding (Literal['json', 'etf'] | UndefinedType) – Whether to use json or etf for payloads

  • compress (Literal['zlib-stream'] | UndefinedType) – Payload compression from data sent from Discord.

Raises
Returns

The gateway websocket

Return type

aiohttp.ClientWebSocketResponse

async create_auto_moderation_rule(authentication, guild_id, *, name, event_type, trigger_type, trigger_metadata=UndefinedType.UNDEFINED, actions, enabled=UndefinedType.UNDEFINED, exempt_roles=UndefinedType.UNDEFINED, exempt_channels=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, global_priority=0, bucket_priority=0, wait=True)#

Create a new auto moderation rule.

Read the documentation

Note

This requires the MANAGE_GUILD permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild to create the auto moderation rule in.

  • name (str) – The name of the auto moderation rule.

  • event_type (discord_typings.AutoModerationEventTypes) – The event type of the auto moderation rule.

  • trigger_type (discord_typings.AutoModerationTriggerTypes) – The trigger type of the auto moderation rule.

  • trigger_metadata (discord_typings.AutoModerationTriggerMetadataData | UndefinedType) – The trigger metadata of the auto moderation rule.

  • actions (list[AutoModerationActionData]) – The actions to do when this rule got triggered.

  • enabled (bool | UndefinedType) – Whether the rule is enabled.

  • exempt_roles (list[Snowflake] | UndefinedType) – The roles that are exempt from this rule.

  • exempt_channels (list[Snowflake] | UndefinedType) – The channels that are exempt from this rule.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • reason (str | UndefinedType) –

Raises
async create_channel_invite(authentication, channel_id, *, max_age=UndefinedType.UNDEFINED, max_uses=UndefinedType.UNDEFINED, temporary=UndefinedType.UNDEFINED, unique=UndefinedType.UNDEFINED, target_type=UndefinedType.UNDEFINED, target_user_id=UndefinedType.UNDEFINED, target_application_id=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates an invite for a channel.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to create an invite for.

  • max_age (int | UndefinedType) –

    How long the invite should last.

    Note

    This has to be between 0 and 604800 seconds. (7 days)

    Setting this to 0 will make it never expire.

  • max_uses (int | UndefinedType) – How many times the invite can be used before getting deleted.

  • temporary (bool | UndefinedType) –

    Whether the invite grants temporary membership.

    This will kick members if they havent got a role when logging off.

  • unique (bool | UndefinedType) – Whether discord will make a new invite regardless of existing invites.

  • target_type (Literal[0, 1] | UndefinedType) –

    The type of the target.

    • 0: A user’s stream

    • 1: EMBEDDED Activity

  • target_user_id (Snowflake | UndefinedType) –

    The id of the user streaming to invite to.

    Note

    This can only be set if target_type is 0.

  • target_application_id (Snowflake | UndefinedType) –

    The id of the EMBEDDED activity to play.

    Note

    This can only be set if target_type is 1.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite data.

Return type

InviteData

async create_dm(authentication, recipient_id, *, bucket_priority=0, global_priority=0, wait=True)#

Creates a DM channel

Read the documentation

Warning

You should not use this endpoint to DM everyone in a server about something. DMs should generally be initiated by a user action.

If you open a significant amount of DMs too quickly, your bot may be blocked from opening new ones.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • recipient_id (Snowflake) – The id of user to DM.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The DM channel created/fetched.

Return type

discord_typings.DMChannelData

async create_global_application_command(authentication, application_id, name, description, *, name_localizations=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, dm_permission=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a global application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • name (str) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • dm_permission (bool | None | UndefinedType) –

    Whether the command can be used in DMs.

    Note

    If this is UNDEFINED, it defaults to True.

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The command that was created

Return type

discord_typings.ApplicationCommandData

async create_guild(authentication, name, *, icon=UndefinedType.UNDEFINED, verification_level=UndefinedType.UNDEFINED, default_message_notifications=UndefinedType.UNDEFINED, explicit_content_filter=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, channels=UndefinedType.UNDEFINED, afk_channel_id=UndefinedType.UNDEFINED, afk_timeout=UndefinedType.UNDEFINED, system_channel_id=UndefinedType.UNDEFINED, system_channel_flags=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Create a guild

Read the documentation.

Note

This can only be used by bots in less than 10 guilds.

Note

This dispatches a GUILD_CREATE event

Parameters
  • authentication (BotAuthentication) – The auth info

  • name (str) – The guild name

  • icon (str | UndefinedType) – A base64 encoded 128x128px icon of the guild.

  • verification_level (Literal[0, 1, 2, 3, 4] | UndefinedType) – The guild verification level

  • default_message_notifications (Literal[0, 1] | UndefinedType) –

    The default message notification level

    • 0: All messages

    • 1: Only mentions

  • explicit_content_filter_level

    The explicit content filter level.

    • 0 Disabled

    • 1 Members without roles

    • 2 All members

  • roles (list[RoleData] | UndefinedType) –

    A list of roles to initially create.

    Hint

    The id here is just a placeholder and can be used other places in this payload to reference it.

    It will be replaced by a snowflake by Discord once it has been created

  • channels (list[PartialChannelData] | UndefinedType) –

    Channels to initially create

    Note

    Not providing this will create a default setup

    Hint

    The id here is just a placeholder and can be used other places in this payload to reference it.

    It will be replaced by a snowflake by Discord once it has been created

    Hint

    Overwrites can be created by using a placeholder in the target and using the same placeholder as a role id.

  • afk_channel_id (Snowflake | UndefinedType) – The voice channel afk members will be moved to when idle in voice chat.

  • afk_timeout (int | UndefinedType) – The time in seconds a member has to be idle in a voice channel to be moved to the afk_channel_id

  • system_channel_id (Snowflake | UndefinedType) – The id of the channel where guild notices such as welcome messages and boost events are posted

  • system_channel_flags (int | UndefinedType) – A bitwise flag deciding what messages to post in the system channel.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • explicit_content_filter (Literal[0, 1, 2] | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildData

async create_guild_application_command(authentication, application_id, guild_id, name, description, *, name_localizations=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The guild to add the command to

  • name (str) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The command that was created

Return type

discord_typings.ApplicationCommandData

async create_guild_ban(authentication, guild_id, user_id, *, delete_message_days=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Bans a user from a guild

Read the documentation

Note

This requires the BAN_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of the guild to ban the member from

  • user_id (Snowflake) – The id of the user to ban

  • delete_message_days (int | UndefinedType) – Delete all messages younger than delete_message_days days sent by the user.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async create_guild_from_guild_template(authentication, template_code, name, *, icon=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a guild from a template

Read the documentation

Warning

This will fail if the bot is in more than 10 guilds.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • template_code (str) – The template code to create the guild from

  • name (str) – The name of the guild

  • icon (str | UndefinedType) – Base64 encoded 128x128px image to set the guild icon to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guild created

Return type

discord_typings.GuildData

async create_guild_role(authentication, guild_id, *, name=UndefinedType.UNDEFINED, permissions=UndefinedType.UNDEFINED, color=UndefinedType.UNDEFINED, hoist=UndefinedType.UNDEFINED, icon=UndefinedType.UNDEFINED, unicode_emoji=UndefinedType.UNDEFINED, mentionable=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a role

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to create the role in

  • name (str | UndefinedType) – The name of the role

  • permissions (str | UndefinedType) – The permissions the role has

  • color (int | UndefinedType) – The color of the role

  • hoist (bool | UndefinedType) – If the role will be split into a seperate section in the member list.

  • icon (str | None | UndefinedType) –

    Base64 encoded image data of the role icon

    Note

    This requires the ROLE_ICONS guild feature.

  • unicode_emoji (str | None | UndefinedType) –

    A unicode emoji to use for the role icon.

    Note

    This requires the ROLE_ICONS guild feature.

  • mentionable (bool | UndefinedType) – Whether the role can be mentioned by members without the MENTION_EVERYONE permission.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The role that was created

Return type

discord_typings.RoleData

async create_guild_scheduled_event(authentication, guild_id, name, privacy_level, scheduled_start_time, entity_type, *, channel_id=UndefinedType.UNDEFINED, entity_metadata=UndefinedType.UNDEFINED, scheduled_end_time=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, image=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Create a scheduled event

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to create the scheduled event in

  • name (str) – The name of the event

  • privacy_level (Literal[2]) –

    Who can join the event

    Note

    This can currently only be 2

  • scheduled_start_time (str) – A ISO8601 timestamp of when the event should start

  • entity_type (Literal[1, 2, 3]) –

    What the event points to.

    Types: - 1: A stage channel - 2 A voice channnel - 3 A external link

  • channel_id (Snowflake | None | UndefinedType) – The channel the event is for

  • entity_metadata (GuildScheduledEventEntityMetadata | UndefinedType) – Metadata about the event spesific to what entity_type you chose.

  • scheduled_end_time (str | UndefinedType) – A ISO8601 timestamp of when the event ends.

  • description (str | UndefinedType) – The description of the event.

  • image (str | UndefinedType) – A base64 encoded image to use as a cover.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The scheduled event that was created

Return type

discord_typings.GuildScheduledEventData

async create_guild_template(authentication, guild_id, name, *, description=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a template from a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild to create a template from

  • name (str) –

    The name of the template

    Note

    This has to be between 2 and 100 characters long.

  • description (str | UndefinedType) –

    The description of the template

    Note

    This has to be between 0 and 120 characters long.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guild created

Return type

discord_typings.GuildData

async create_message(authentication, channel_id, *, content=UndefinedType.UNDEFINED, tts=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, message_reference=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, sticker_ids=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a message in a channel.

Read the documentation

Note

This requires the view_channel and send_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to create a message in.

  • content (str | UndefinedType) – The content of the message.

  • tts (bool | UndefinedType) –

    Whether the content should be spoken out by the Discord client upon send.

    Note

    This will still set Message.tts to True even if content is not provided.

  • embeds (list[EmbedData] | UndefinedType) –

    The embeds to send with the message.

    Hint

    The fields are in the Embed documentation.

    Note

    There is a maximum 6,000 character limit across all embeds.

    Read the embed limits documentation for more info.

  • allowed_mentions (AllowedMentionsData | UndefinedType) – The allowed mentions for the message.

  • message_reference (MessageReferenceData | UndefinedType) – The message to reply to.

  • components (list[ActionRowData] | UndefinedType) – The components to send with the message.

  • sticker_ids (list[int] | UndefinedType) –

    A list of sticker ids to attach to the message.

    Note

    This has a max of 3 stickers.

  • files (Iterable[File] | UndefinedType) – The files to send with the message.

  • attachments (list[AttachmentData] | UndefinedType) –

    Metadata about the files parameter.

    Note

    This only includes the filename and description fields.

  • flags (int | UndefinedType) –

    Bitwise flags to send with the message.

    Note

    Only the SUPRESS_EMBEDS flag can be set.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was sent.

Return type

discord_typings.MessageData

async create_reaction(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Creates a reaction to a message.

Read the documentation

Note

This requires the read_message_history permission.

This also requires the add_reactions permission if noone else has reacted to the message with this emoji.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to add a reaction to.

  • emoji (str) –

    The emoji to add to the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async create_stage_instance(authentication, channel_id, topic, *, privacy_level=UndefinedType.UNDEFINED, send_start_notification=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to create a stage instance in

  • topic (str) –

    The topic of the stage instance

    Note

    This has to be between 1 and 120 characters.

  • privacy_level (Literal[1, 2] | UndefinedType) –

    The privacy level of the stage instance.

    Note

    This will default to 2/Guild only if not provided.

    Possible values - 1: Public (deprecated) - 2 Guild only

  • send_start_notification (bool | UndefinedType) –

    If you should send a notification to all members in the guild

    Note

    Setting this to True requires the MENTION_EVERYONE permission.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stage instance that was created.

Return type

discord_typings.StageInstanceData

async create_webhook(authentication, channel_id, name, *, avatar=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a webhook

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to create a webhook in

  • name (str) –

    The name of the webhook

    Note

    This has to be between 1 and 80 characters.

    It has to follow the Discord nickname restrictions (with the exception of the length limit.)

  • avatar (str | None | UndefinedType) – Base64 encoded image avatar to use as the default avatar

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was created

Return type

discord_typings.WebhookData

async crosspost_message(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Publishes a message in a news channel

Read the documentation

Note

This requires the send_messages permission when trying to crosspost a message sent by the current user.

If not this requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to crosspost the message to.

  • message_id (Snowflake) – The id of the message to crosspost.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was crossposted.

Return type

discord_typings.MessageData

async delete_all_reactions(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes all reactions from a message.

Read the documentation

Note

This requires the MANAGE_MESSAGES permission.

Note

This will cause a MESSAGE_REACTION_REMOVE_ALL dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove all reactions from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_all_reactions_for_emoji(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes all reactions from a message with a specific emoji.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_REACTION_REMOVE_EMOJI dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove all reactions from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_auto_moderation_rule(authentication, guild_id, rule_id, *, reason=UndefinedType.UNDEFINED, global_priority=0, bucket_priority=0, wait=True)#

Delete an auto moderation rule.

Read the documentation

Note

This requires the MANAGE_GUILD permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild that the auto moderation rule is in.

  • rule_id (Snowflake) – The auto moderation rule id.

  • reason (str) –

    A reason for the audit log.

    Note

    This must be in 1 and 512 characters.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

async delete_channel(authentication, channel_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel.

Read the documentation

Note

This requires the MANAGE_CHANNELS for channels and MANAGE_THREADS for threads

DMs does not require any permissions to close

Warning

Deleting a category will not delete the channels under it.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_channel_permission(authentication, channel_id, target_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel permission.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to delete the permission from.

  • target_id (Snowflake) – The id of the user or role to delete the permission from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_followup_message(application_id, interaction_token, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a response sent to a interaction by message id

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • message_id (Snowflake) – The id of the message to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

MessageData

async delete_global_application_command(authentication, application_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a global command

Read the documentation

Raises
Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Return type

None

async delete_guild(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a guild

Read the documentation

Note

You have to be the guild owner to delete it.

Note

This dispatches a GUILD_DELETE event

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The id of the guild to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_application_command(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • guild_id (Snowflake) – The guild where the command is located in

  • command_id (Snowflake) – The command to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_guild_emoji(authentication, guild_id, emoji_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Delete a emoji

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Note

This dispatches a GUILD_EMOJIS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to get the emoji from

  • emoji_id (int | str) – The emoji to get

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async delete_guild_integration(authentication, guild_id, integration_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a integration

Read the documentation

Note

This will delete any associated webhooks and kick any associated bots.

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the integration is located in

  • integration_id (Snowflake) – The id of the integration to delete

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_role(authentication, guild_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id – The id of the role to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • guild_id (Snowflake) –

  • role_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_scheduled_event(authentication, guild_id, guild_scheduled_event_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes scheduled event.

Read the documentation

Note

This requires the MANAGE_EVENTS guild permission.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the scheduled event is in

  • guild_scheduled_event_id (Snowflake) – The id of the event to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_sticker(authentication, guild_id, sticker_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id – The id of the stage channel to delete the stage instance for.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • guild_id (Snowflake) –

  • sticker_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_template(authentication, guild_id, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a template

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id where the template is located

  • template_code (str) – The code of the template to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The deleted template

Return type

discord_typings.GuildTemplateData

async delete_invite(authentication, invite_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a invite from a invite code

Read the documentation

Note

This requires the MANAGE_CHANNELS permission in the channel the invite is from or the MANAGE_GUILD permission.

Note

This will dispatch a INVITE_DELETE event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • invite_code (str) – The code of the invite to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite that was deleted

Return type

discord_typings.InviteData

async delete_message(authentication, channel_id, message_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a message.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_DELETE dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to delete.

  • reason (str | UndefinedType) –

    The reason for deleting the message.

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_original_interaction_response(application_id, interaction_token, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes the first response sent to a interaction

Read the documentation

Note

You can not delete ephemeral responses

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_own_reaction(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a reaction from a message.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove a reaction from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_stage_instance(authentication, channel_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to delete the stage instance for.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_user_reaction(authentication, channel_id, message_id, emoji, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a reaction from a message from another user.

Read the documentation

Note

This requires the manage_messages permission.

Note

This does not error when attempting to remove a reaction that does not exist.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove a reaction from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • user_id (Snowflake) – The id of the user to remove the reaction from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_webhook(authentication, webhook_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was deleted

Return type

discord_typings.WebhookData

async delete_webhook_message(webhook_id, webhook_token, message_id, *, thread_id=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a message sent by the webhook

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch a message from

  • webhook_token (str) – The token of the webhook

  • message_id (Snowflake) – The id of the message to fetch

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to fetch the message from

    Note

    This has to be a thread in the channel the webhook is in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_webhook_with_token(webhook_id, webhook_token, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a webhook

Read the documentation

Parameters
  • webhook_id (Snowflake) – The id of the webhook to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • webhook_token (str) –

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async edit_channel_permissions(authentication, channel_id, target_type, target_id, *, allow=UndefinedType.UNDEFINED, deny=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Edits the permissions of a channel.

Read the documentation

Note

This requires the manage_roles permission.

This also requires the permissions you want to grant/deny unless your bot has a manage_roles overwrite.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to edit.

  • target_type (Literal[0, 1]) –

    The type of the target.

    • 0: Role

    • 1: User

  • target_id (Snowflake) – The id of the target to edit permissions for.

  • allow (str | None | UndefinedType) –

    A bitwise flag of permissions to allow.

    Note

    If this is set to None, it will default to 0.

  • deny (str | None | UndefinedType) –

    A bitwise flag of permissions to allow.

    Note

    If this is set to None, it will default to 0.

  • reason (str | UndefinedType) –

    The reason to show in audit log

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async edit_global_application_command(authentication, application_id, command_id, *, name=UndefinedType.UNDEFINED, name_localizations=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, dm_permission=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a global application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • name (str | UndefinedType) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str | UndefinedType) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • dm_permission (bool | None | UndefinedType) –

    Whether the command can be used in DMs.

    Note

    If this is UNDEFINED, it defaults to True.

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The command that was edited

Return type

discord_typings.ApplicationCommandData

async edit_guild_application_command(authentication, application_id, guild_id, command_id, *, name=UndefinedType.UNDEFINED, name_localizations=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a guild application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The id of the guild where the command is located in

  • name (str | UndefinedType) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str | UndefinedType) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The command that was edited

Return type

discord_typings.ApplicationCommandData

async edit_message(authentication, channel_id, message_id, *, content=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Edits a message.

Read the documentation

Note

This requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to edit.

  • content (str | None | UndefinedType) –

    The new content of the message.

    Note

    If this is set to None, there will be no message contents.

    Note

    Adding/removing mentions will not affect mentions.

  • embeds (list[EmbedData] | None | UndefinedType) –

    The new embeds of the message.

    This overwrites the previous embeds

  • flags (int | None | UndefinedType) –

    The new flags of the message.

    Warning

    Only the SUPPRESS_EMBEDS flag can be set. Trying to set other flags will be ignored.

  • allowed_mentions (AllowedMentionsData | None | UndefinedType) –

    The new allowed mentions of the message.

    Note

    Setting this to None will make it use the default allowed mentions.

  • components (list[ActionRowData] | None | UndefinedType) – The new components of the message.

  • files (list[File] | None | UndefinedType) – The new files of the message.

  • attachments (list[AttachmentData] | None | UndefinedType) –

    The new attachments of the message.

    Warning

    This has to include previous and current attachments or they will be removed.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The edited message.

Return type

MessageData

async execute_webhook(authentication, webhook_id, webhook_token, *, discord_wait=UndefinedType.UNDEFINED, thread_id=UndefinedType.UNDEFINED, content=UndefinedType.UNDEFINED, username=UndefinedType.UNDEFINED, avatar_url=UndefinedType.UNDEFINED, tts=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, message_reference=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, sticker_ids=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, thread_name=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Sends a message to a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook.

  • webhook_token (str) –

    The token of the webhook.

    Warning

    You should keep this private!

  • discord_wait (bool | UndefinedType) – Whether to wait for the message to be fully sent on Discord’s end.

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to post the message in.

    Warning

    This will unarchive any thread

  • content (str | UndefinedType) – The content of the message.

  • username (str | UndefinedType) – The name of the user. If not provided this will use the webhook default

  • avatar_url (str | UndefinedType) – The url of the avatar. If not provided this will use the webhook default.

  • tts (bool | UndefinedType) –

    Whether the content should be spoken out by the Discord client upon send.

    Note

    This will still set Message.tts to True even if content is not provided.

  • embeds (list[EmbedData] | UndefinedType) –

    The embeds to send with the message.

    Hint

    The fields are in the Embed documentation.

    Note

    There is a maximum 6,000 character limit across all embeds.

    Read the embed limits documentation for more info.

  • allowed_mentions (AllowedMentionsData | UndefinedType) – The allowed mentions for the message.

  • message_reference (MessageReferenceData | UndefinedType) – The message to reply to.

  • components (list[ActionRowData] | UndefinedType) –

    The components to send with the message.

    Note

    The webhook must have been created by a bot for this to work.

  • sticker_ids (list[int] | UndefinedType) –

    A list of sticker ids to attach to the message.

    Note

    This has a max of 3 stickers.

  • files (Iterable[File] | UndefinedType) – The files to send with the message.

  • attachments (list[AttachmentData] | UndefinedType) –

    Metadata about the files parameter.

    Note

    This only includes the filename and description fields.

  • flags (int | UndefinedType) –

    Bitwise flags to send with the message.

    Note

    Only the SUPRESS_EMBEDS flag can be set.

  • thread_name (str | UndefinedType) –

    The name of the thread to create.

    Warning

    This can only be provided when the webhook is for a forum channel.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was sent.

Return type

discord_typings.MessageData

async follow_news_channel(authentication, channel_id, webhook_channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Follows a news channel.

Read the documentation

Note

This requires the manage_webhooks permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to follow.

  • webhook_channel_id (Snowflake) – The id of the channel to receive posts to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The followed channel data.

Return type

FollowedChannelData

async get_application_command_permissions(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets permissions for a command in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • command_id (Snowflake) – The id of the command to fetch

  • guild_id (Snowflake) – The guild to get permissions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The application command permissions overwrites for the command

Return type

discord_typings.GuildApplicationCommandPermissionData

async get_auto_moderation_rule(authentication, guild_id, rule_id, *, global_priority=0, bucket_priority=0, wait=True)#

List all auto moderation rules for a guild.

Note

This requires the MANAGE_GUILD permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild that the auto moderation rule is in.

  • rule_id (Snowflake) – The auto moderation rule id.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

Raises
Return type

AutoModerationRuleData

async get_channel(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a channel by ID.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The channel ID to get.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • aiohttp.ClientConnectorError – Could not connect due to a problem with your connection

  • UnauthorizedError – A invalid token was provided

  • NotFound – The channel could not be found

Returns

The channel.

Hint

A list of fields are available in the documentation.

Return type

ChannelData

async get_channel_invites(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the invites for a channel.

Read the documentation

Note

This requires the manage_channels permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get invites for.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invites for the channel.

Return type

list[InviteMetadata]

async get_channel_messages(authentication, channel_id, *, around=UndefinedType.UNDEFINED, before=UndefinedType.UNDEFINED, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets messages from a channel.

Read the documentation

Note

This requires the view_channel permission..

Note

If the read_message_history permission is not given, this will return an empty list.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get messages from.

  • around (int | UndefinedType) –

    The id of the message to get messages around.

    Note

    This does not have to be a valid message id.

  • before (int | UndefinedType) –

    The id of the message to get messages before.

    Note

    This does not have to be a valid message id.

  • after (int | UndefinedType) –

    The id of the message to get messages after.

    Note

    This does not have to be a valid message id.

  • limit (int | UndefinedType) –

    The number of messages to get.

    Note

    This has to be between 1-100.

    Note

    If this is not provided it will default to 50.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

list[MessageData]

async get_channel_webhooks(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all webhooks in a channel

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get webhooks from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhooks in the channel

Return type

list[discord_typings.WebhookData]

async get_current_authorization_information(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the bots application

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Info about the current logged in user/bot

Return type

discord_typings.???

async get_current_bot_application_information(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the bots application

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The application the bot is connected to

Return type

discord_typings.ApplicationData

async get_current_user(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the current user

Read the documentation

Note

If you are using BearerAuthentication you need the IDENTIFY scope.

UserData.email will only be provided if you have the EMAIL scope.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current user

Return type

discord_typings.UserData

async get_current_user_guild_member(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the current users member in a guild

Read the documentation

Note

This requires the guilds.members.read scope

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get the member in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current member

Return type

discord_typings.GuildMemberData

async get_current_user_guilds(authentication, *, before=UndefinedType.UNDEFINED, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the guilds the current user is in

Read the documentation

Note

If you are using BearerAuthentication you need the guilds scope.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • before (Snowflake | UndefinedType) –

    Get guilds before this id

    Note

    This does not have to be a valid id.

  • after (Snowflake | UndefinedType) –

    Get guilds after this id

    Note

    This does not have to be a valid id.

  • limit (int | UndefinedType) –

    The max amount of guilds to return

    Note

    This has to be between 1 and 200

    Note

    This defaults to 200

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guilds fetched

Return type

list[discord_typings.PartialGuildData]

async get_followup_message(application_id, interaction_token, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a response sent to a interaction by message id

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • message_id (Snowflake) – The id of the message to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was fetched

Return type

discord_typings.MessageData

async get_gateway()#

Gets gateway connection info.

Read the documentation for more info.

Example usage:

gateway_info = await http_client.get_gateway()
Returns

The gateway info.

Return type

discord_typings.GetGatewayData

async get_gateway_bot(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets gateway connection information.

Read the documentation

Example usage:

bot_info = await http_client.get_gateway_bot(token)
Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Gateway connection info.

Return type

discord_typings.GetGatewayBotData

async get_global_application_command(authentication, application_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a global command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The global commmand fetched

Return type

discord_typings.ApplicationCommandData

async get_global_application_commands(authentication, application_id, *, with_localizations=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all global commands

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_localizations (bool | UndefinedType) –

Raises
Returns

The global commmands registered to the application

Return type

list[discord_typings.ApplicationCommandData]

async get_guild(authentication, guild_id, *, with_counts=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Get a guild by ID

Read the documentation

Parameters
  • authentication (BotAuthentication) – The authenticaton info.

  • guild_id (Snowflake) – The guild to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_counts (bool | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildData

async get_guild_application_command(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • guild_id (Snowflake) – The guild to get the command from

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The global commmand fetched

Return type

discord_typings.ApplicationCommandData

async get_guild_application_command_permissions(authentication, application_id, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all application command permissions in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • guild_id (Snowflake) – The guild to get permissions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The application command permissions overwrites in the guild

Return type

list[discord_typings.GuildApplicationCommandPermissionData]

async get_guild_application_commands(authentication, application_id, guild_id, *, with_localizations=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all commands in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • guild_id (Snowflake) – The guild to get commands from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_localizations (bool | UndefinedType) –

Raises
Returns

The commmands registered to the guild

Return type

list[discord_typings.ApplicationCommandData]

async get_guild_audit_log(authentication, guild_id, *, user_id=UndefinedType.UNDEFINED, action_type=UndefinedType.UNDEFINED, before=UndefinedType.UNDEFINED, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the guild audit log.

Read the documentation

Note

This requires the VIEW_AUDIT_LOG permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild to query the audit log for.

  • user_id (int | UndefinedType) –

    The user to filter the audit log by.

    This will be the user that did the action if present, if not it will be the user that got actioned.

  • action_type (AuditLogEvents | UndefinedType) – The action type to filter the audit log by.

  • before (int | UndefinedType) –

    Get entries before this entry.

    Note

    This does not have to be a valid entry id.

  • after (int | UndefinedType) –

    Get entries before after entry.

    Note

    This does not have to be a valid entry id.

  • limit (int | UndefinedType) –

    The amount of entries to get.

    Note

    This has a minimum of 1 and a maximum of 100.

    Note

    This defaults to 50.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The guild audit log.

Hint

A list of fields are available in the documentation.

Return type

AuditLogData

async get_guild_ban(authentication, guild_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a ban

Read the documentation

Note

This requires the BAN_MEMBERS permission..

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get the ban from

  • user_id (Snowflake) – The user to get ban info for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

BanData

async get_guild_bans(authentication, guild_id, *, before=UndefinedType.UNDEFINED, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets a list of bans in a guild.

Read the documentation

Note

This requires the BAN_MEMBERS permission..

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get bans from

  • before (Snowflake | UndefinedType) –

    Do not return bans from users with a id more than this.

    Note

    This does not have to be a id of a existing user.

  • after (Snowflake | UndefinedType) –

    Do not return bans from users with a id less than this.

    Note

    This does not have to be a id of a existing user.

  • limit (int | UndefinedType) –

    The number of bans to get.

    Note

    This has to be between 1-100.

    Note

    If this is not provided it will default to 50.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[BanData]

async get_guild_channels(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all channels in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild to get channels from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[ChannelData]

async get_guild_emoji(authentication, guild_id, emoji_id, *, bucket_priority=0, global_priority=0, wait=True)#

Get emoji info

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to get the emoji from

  • emoji_id (int | str) – The emoji to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async get_guild_integrations(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets guild integrations

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get integrations for

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[IntegrationData]

async get_guild_invites(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all guild invites

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get invites for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[InviteMetadata]

async get_guild_member(authentication, guild_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the member from

  • user_id (str | int) – The user to get the member from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildMemberData

async get_guild_preview(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a guild preview by ID

Read the documentation

Note

If the bot is not in the guild, it needs the LURKABLE feature.

Parameters
  • authentication (BotAuthentication) – The authentication info

  • guild_id (Snowflake) – The id of the guild to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildPreviewData

async get_guild_prune_count(authentication, guild_id, *, days=UndefinedType.UNDEFINED, include_roles=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the amount of members that would be pruned

Read the documentation <https://discord.dev/resources/guild#get-guild-prune-count>

Note

This requires the KICK_MEMBERS permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the prune count for

  • days (int | UndefinedType) –

    How many days a user has to be inactive for to get included in the prune count

    Note

    If this is UNDEFINED, this will default to 7.

  • include_roles (list[str] | UndefinedType) – IDs of roles to be pruned aswell as the default role.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[str, Any]

async get_guild_roles(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all roles in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the roles from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The roles in the guild

Return type

list[discord_typings.RoleData]

async get_guild_scheduled_event(authentication, guild_id, guild_scheduled_event_id, *, with_user_count=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets a scheduled event by id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild scheduled events from

  • guild_scheduled_event_id (Snowflake) – The id of the event to get.

  • with_user_count (bool | UndefinedType) – Include discord_typings.GuildScheduledEventData.user_count

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildScheduledEventData

async get_guild_sticker(authentication, guild_id, sticker_id, *, bucket_priority=0, global_priority=0, wait=True)#

Get a custom sticker

Read the documentation

Note

The user field will be provided if you have the MANAGE_EMOJIS_AND_STICKERS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the sticker from

  • sticker_id (str | int) – The sticker to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stickers in the guild

Return type

list[discord_typings.StickerData]

async get_guild_template(authentication, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a template by code

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • template_code (str) – The template code to get the template from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The template you requested

Return type

discord_typings.GuildTemplateData

async get_guild_templates(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all templates in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id to get templates from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The templates in the guild

Return type

list[discord_typings.GuildTemplateData]

async get_guild_vanity_url(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the vanity invite from a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async get_guild_voice_regions(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets voice regions for a guild.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get voice regions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[VoiceRegionData]

async get_guild_webhooks(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all webhooks in a guild

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get webhooks from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhooks in the channel

Return type

list[discord_typings.WebhookData]

async get_guild_welcome_screen(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the welcome screen for a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the welcome screen for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

WelcomeScreenData

async get_guild_widget(guild_id)#

Gets a widget from a guild id

Read the documentation

Parameters

guild_id (Snowflake) – The id of guild to get the widget for.

Return type

GuildWidgetData

async get_guild_widget_settings(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets widget settings for a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the widget settings for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async get_invite(authentication, invite_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a invite from a invite code

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • invite_code (str) – The code of the invite to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite that was fetched

Return type

discord_typings.InviteData

async get_original_interaction_response(application_id, interaction_token, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the first response sent to a interaction

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • aiohttp.ClientConnectorError – Could not connect due to a problem with your connection

  • UnauthorizedError – A invalid token was provided

  • NotFoundError – You have not responded or the response was ephemeral or a defer that has not been completed yet.

Returns

The message

Return type

discord_typings.MessageData

async get_pinned_messages(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the pinned messages of a channel.

Read the documentation

Note

This requires the read_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get the pinned messages of.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The pinned messages.

Return type

list[discord_typings.MessageData]

async get_reactions(authentication, channel_id, message_id, emoji, *, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the reactions to a message.

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to get the reactions from.

  • emoji (str) – The emoji to get reactions for

  • after (Snowflake | UndefinedType) –

    A snowflake of that the reaction id has to be higher than to be included

    Note

    This does not have to be a valid snowflake

  • limit (int | UndefinedType) –

    The max amount of reactions to return

    Note

    This has to be between 1 and 100

    Note

    This defaults to 25

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The users that has reacted with this emoji.

Return type

list[UserData]

async get_stage_instance(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a stage instance from a stage channel id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The code of the invite to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stage instance that was fetched.

Return type

discord_typings.StageInstanceData

async get_sticker(authentication, sticker_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a sticker from a sticker id.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • sticker_id (Snowflake) – The id of the sticker to get.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The sticker that was fetched

Return type

discord_typings.StickerData

async get_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a thread member.

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to get from

  • user_id (str | int) – The member to get info from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • NotFoundError – The member is not part of the thread.

Return type

ThreadMemberData

async get_user(authentication, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a user by id

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • user_id (Snowflake) – The id of the user to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The user you fetched

Return type

discord_typings.UserData

async get_user_connections(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the users connections

Read the documentation

Note

This requires the connections scope

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current member

Return type

discord_typings.GuildMemberData

async get_webhook(authentication, webhook_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a webhook by webhook id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async get_webhook_message(webhook_id, webhook_token, message_id, *, thread_id=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets a message sent by the webhook

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch a message from

  • webhook_token (str) – The token of the webhook

  • message_id (Snowflake) – The id of the message to fetch

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to fetch the message from

    Note

    This has to be a thread in the channel the webhook is in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The message that was fetched

Return type

discord_typings.MessageData

async get_webhook_with_token(webhook_id, webhook_token, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a webhook by webhook id and token

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch

  • webhook_token (str) – The token of the webhook

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async group_dm_add_recipient(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Adds a recipient to a group DM.

Read the documentation

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to add the recipient to.

  • user_id (Snowflake) – The id of the user to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async group_dm_remove_recipient(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Removes a recipient from a group DM.

Read the documentation

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to remove the recipient from.

  • user_id (Snowflake) – The id of the user to remove.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async join_thread(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Joins a thread.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The thread to join.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async leave_guild(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Leave a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to leave

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current user

Return type

discord_typings.UserData

async leave_thread(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Leaves a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The channel to leave

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async list_active_guild_threads(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

List active guild threads

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get threads from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_auto_moderation_rules_for_guild(authentication, guild_id, *, wait=True, global_priority=0, bucket_priority=0)#

List all auto moderation rules for a guild.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild to list the auto moderation rules for.

  • wait (bool) – Whether to wait when getting rate limited.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

Raises
Return type

list[AutoModerationRuleData]

async list_guild_emojis(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

List all emojis in a guild.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to list emojis from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async list_guild_members(authentication, guild_id, *, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Lists members in a guild

Read the documentation

Note

This requires the GUILD_MEMBERS intent enabled in the developer portal

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the members from

  • after (int | UndefinedType) –

    What a members id has to be above for them to be returned.

    Hint

    This is usually the highest user id in the previous page.

    Note

    This defaults to 0

  • limit (int | UndefinedType) –

    How many members to return per page

    Note

    This defaults to 1

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildMemberData]

async list_guild_stickers(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all custom stickers added by a guild

Read the documentation

Note

The user field will be provided if you have the MANAGE_EMOJIS_AND_STICKERS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get stickers from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stickers in the guild

Return type

list[discord_typings.StickerData]

async list_joined_private_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List private archived threads the bot has joined.

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission.

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_nitro_sticker_packs(*, bucket_priority=0, global_priority=0, wait=True)#

Gets all nitro sticker packs

Read the documentation

Parameters
  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[Literal[‘sticker_packs’], list[StickerPackData]]

async list_private_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List private archived threads

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_public_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List public archived threads

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_scheduled_events_for_guild(authentication, guild_id, *, with_user_count=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all scheduled events for a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild scheduled events from

  • with_user_count (bool | UndefinedType) – Include discord_typings.GuildScheduledEventData.user_count

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildScheduledEventData]

async list_thread_members(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all thread members

Read the documentation

Warning

You need the GUILD_MEMBERS privileged intent!

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to get members from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[ThreadMemberData]

async list_voice_regions(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the users connections

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Voice regions

Return type

list[discord_typings.VoiceRegionData]

async modify_current_member(authentication, guild_id, *, nick=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the member to update is in.

  • nick (str | None | UndefinedType) –

    What to change the users nickname to.

    Note

    Setting it to None will remove the nickname.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The member after the update

Return type

discord_typings.GuildMemberData

async modify_current_user(authentication, *, username=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the current user

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • username (str | UndefinedType) – The username to update to

  • avatar (str | UndefinedType) – Base64 encoded image to change the current users avatar to

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated user

Return type

discord_typings.UserData

async modify_current_user_voice_state(authentication, guild_id, channel_id, *, suppress=UndefinedType.UNDEFINED, request_to_speak_timestamp=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the voice state of the bot

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • channel_id (Snowflake) – The id of a stage channel the bot is in

  • suppress (bool | UndefinedType) –

    Whether to be in the audience.

    Note

    You need the MUTE_MEMBERS if you want to set this to False, however no permission is required to set it to False.

  • request_to_speak_timestamp (str | None | UndefinedType) –

    A timestamp of when a user requested to speak.

    Note

    There is no validation if this is in the future or the past.

    Note

    You need the REQUEST_TO_SPEAK to set this to a non-None value, however setting it to None requires no permission.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_group_dm(authentication, channel_id, *, name=UndefinedType.UNDEFINED, icon=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the group dm.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_guild_channel and HTTPClient.modify_thread.

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the group dm channel to update

  • name (str | UndefinedType) –

    The name of the group dm.

    Note

    This has to be between 1 to 100 characters long.

  • icon (str | None | UndefinedType) – A base64 encoded image of what to change the group dm icon to.

  • reason (str | UndefinedType) –

    A reason for the audit log.

    Note

    This has to be between 1 and 512 characters

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ChannelData

async modify_guild_channel(authentication, channel_id, *, name=UndefinedType.UNDEFINED, channel_type=UndefinedType.UNDEFINED, position=UndefinedType.UNDEFINED, topic=UndefinedType.UNDEFINED, nsfw=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, bitrate=UndefinedType.UNDEFINED, user_limit=UndefinedType.UNDEFINED, permission_overwrites=UndefinedType.UNDEFINED, parent_id=UndefinedType.UNDEFINED, rtc_region=UndefinedType.UNDEFINED, video_quality_mode=UndefinedType.UNDEFINED, default_auto_archive_duration=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guild channel.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_group_dm and HTTPClient.modify_thread.

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to update.

  • name (str | UndefinedType) – The name of the channel.

  • channel_type (Literal[0, 5] | UndefinedType) –

    The type of the channel.

    Note

    This is named type in the API, however to not overwrite the type function in python this is changed here.

  • position (int | None | UndefinedType) –

    The position of the channel.

    Note

    If this is set to None it will default to 0.

  • topic (str | None | UndefinedType) – The channel topic.

  • nsfw (bool | None | UndefinedType) –

    Whether the channel marked as age restricted.

    Note

    If this is set to None it will default to False.

  • rate_limit_per_user (int | None | UndefinedType) –

    How many seconds a user has to wait before sending another message or create a thread.

    Bots, as well as users with the manage_messages or manage_channel are unaffected A member can send one message and create one thread per period.

    Note

    This has to be between 0-21600 seconds.

  • bitrate (int | None | UndefinedType) –

    The bitrate of the channel in bits per second.

    Note

    This only works for stage / voice channels.

    Note

    This has to be between 8000-96000 for guilds without the VIP_REGIONS feature.

    For guilds with the VIP_REGIONS feature this has to be between 8000-128000.

  • user_limit (int | None | UndefinedType) – The maximum amount of users that can be in a voice channel at a time.

  • permission_overwrites (list[dict[Any, Any]] | None | UndefinedType) –

    The permission overwrites for the channel.

    Note

    If this is set to None it will default to an empty list.

  • parent_id (Snowflake | UndefinedType) –

    The id of the parent channel.

    This can be a text channel for threads or a category channel.

  • rtc_region (str | None | UndefinedType) –

    The voice region of the channel.

    Note

    If this is None it is automatic. Every time someone joins a empty channel, the closest region will be used.

  • video_quality_mode (Literal[1, 2] | None | UndefinedType) –

    The video quality mode of the channel.

    Note

    If this is None it will not be present in the Guild payload.

    This is rougly the same as setting it to 1.

  • default_auto_archive_duration (Literal[60, 1440, 4320, 10080] | None | UndefinedType) –

    The default auto archive duration for threads created in this channel.

    Note

    If this is None it will not be present in the Guild payload.

    The client treats this as it being set to 24 hours however this may change without notice.

  • reason (str | UndefinedType) – The reason to put in the audit log.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ChannelData

async modify_guild_channel_positions(authentication, guild_id, *position_updates, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies channel positions

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild to modify channel positions in.

  • position_updates (ChannelPositionData) – The position updates to do.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_guild_emoji(authentication, guild_id, emoji_id, *, name=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modify a emoji

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Note

This dispatches a GUILD_EMOJIS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the emoji is in

  • emoji_id (Snowflake) – The emoji to modify

  • name (str | UndefinedType) – The emoji name.

  • roles (list[Snowflake] | UndefinedType) – IDs of roles that can use this emoji.

  • reason (str | UndefinedType) – Reason to show in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

EmojiData

async modify_guild_member(authentication, guild_id, user_id, *, nick=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, mute=UndefinedType.UNDEFINED, deaf=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, communication_disabled_until=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the member to update is in.

  • nick (str | None | UndefinedType) –

    What to change the users nickname to.

    Note

    Setting it to None will remove the nickname.

    Note

    Setting this requires the MANAGE_NICKNAMES permission

  • roles (list[Snowflake] | None | UndefinedType) –

    The roles the member has.

    Note

    Setting this requires the MANAGE_ROLES permission

  • mute (bool | None | UndefinedType) –

    Whether to server mute the user

    Note

    Setting this requires the MUTE_MEMBERS permission

  • deaf (bool | None | UndefinedType) –

    Whether to server deafen the user

    Note

    Setting this requires the DEAFEN_MEMBERS permission

  • channel_id (Snowflake | None | UndefinedType) –

    The channel to move the member to.

    Warning

    This will fail if the member is not in a voice channel

    Note

    Setting this requires having the VIEW_CHANNEL and CONNECT permissions in the channel_id channel, and the MOVE_MEMBERS permission

  • communication_disabled_until (str | None | UndefinedType) –

    A ISO8601 timestamp of When the member’s timeout will expire.

    Note

    This has to be under 28 days in the future.

    Note

    This requires the MODERATE_MEMBERS permission

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • user_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The member after the update

Return type

discord_typings.GuildMemberData

async modify_guild_role(authentication, guild_id, role_id, *, name=UndefinedType.UNDEFINED, permissions=UndefinedType.UNDEFINED, color=UndefinedType.UNDEFINED, hoist=UndefinedType.UNDEFINED, icon=UndefinedType.UNDEFINED, unicode_emoji=UndefinedType.UNDEFINED, mentionable=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a role

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the role is located in

  • role_id (Snowflake) – The role to modify

  • name (str | UndefinedType) – The name of the role

  • permissions (str | UndefinedType) – The permissions the role has

  • color (int | UndefinedType) – The color of the role

  • hoist (bool | UndefinedType) – If the role will be split into a seperate section in the member list.

  • icon (str | None | UndefinedType) –

    Base64 encoded image data of the role icon

    Note

    This requires the ROLE_ICONS guild feature.

  • unicode_emoji (str | None | UndefinedType) –

    A unicode emoji to use for the role icon.

    Note

    This requires the ROLE_ICONS guild feature.

  • mentionable (bool | UndefinedType) – Whether the role can be mentioned by members without the MENTION_EVERYONE permission.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated role

Return type

discord_typings.RoleData

async modify_guild_role_positions(authentication, guild_id, *position_updates, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies role positions

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to modify role positions in

  • position_updates (RolePositionData) – The positions to update

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[RoleData]

async modify_guild_sticker(authentication, guild_id, sticker_id, *, name=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, tags=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a sticker

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the sticker is in.

  • sticker_id (Snowflake) – The id of the sticker to update

  • name (str | UndefinedType) –

    The name of the sticker.

    Note

    This has to be between 2 and 30 characters

  • description (str | UndefinedType) –

    The description of the sticker

    Note

    This has to be between 2 and 100 characters

  • tags (list[str] | UndefinedType) – Autocomplete/suggestion tags for the sticker (max 200 characters)

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated stage instance

Return type

discord_typings.StageInstanceData

async modify_guild_template(authentication, guild_id, template_code, *, name=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a template.

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id of the template

  • template_code (str) – The code of the template to modify

  • name (str | UndefinedType) –

    What to change the template name to

    Note

    This has to be between 2 and 100 characters long.

  • description (str | UndefinedType) –

    What to change the template description to.

    Note

    This has to be between 0 and 120 characters long.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_guild_welcome_screen(authentication, guild_id, *, enabled=UndefinedType.UNDEFINED, welcome_channels=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guilds welcome screen

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to modify the welcome screen for

  • enabled (bool | None | UndefinedType) – Whether the welcome screen is enabled

  • welcome_channels (list[WelcomeChannelData] | None | UndefinedType) – The channels to show on the welcome screen

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • description (str | None | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

WelcomeScreenData

async modify_guild_widget(authentication, guild_id, *, enabled=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guilds widget settings

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to modify the widget for

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • enabled (bool | UndefinedType) –

  • channel_id (Snowflake | None | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async modify_stage_instance(authentication, channel_id, *, topic=UndefinedType.UNDEFINED, privacy_level=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to modify a stage instance in

  • topic (str | UndefinedType) –

    The topic of the stage instance

    Note

    This has to be between 1 and 120 characters.

  • privacy_level (Literal[1, 2] | UndefinedType) –

    The privacy level of the stage instance.

    Possible values - 1: Public (deprecated) - 2 Guild only

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated stage instance

Return type

discord_typings.StageInstanceData

async modify_thread(authentication, thread_id, *, name=UndefinedType.UNDEFINED, archived=UndefinedType.UNDEFINED, auto_archive_duration=UndefinedType.UNDEFINED, locked=UndefinedType.UNDEFINED, invitable=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a thread.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_group_dm and HTTPClient.modify_guild_channel.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • thread_id (Snowflake) – The id of the thread to update.

  • name (str | UndefinedType) – The name of the thread.

  • archived (bool | UndefinedType) – Whether the thread is archived.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – How long in minutes to automatically archive the thread after recent activity

  • locked (bool | UndefinedType) – Whether the thread can only be un-archived by members with the manage_threads permission.

  • invitable (bool | UndefinedType) – Whether members without the manage_threads permission can invite members without the manage_channels permission to the thread.

  • rate_limit_per_user (int | UndefinedType) –

    The duration in seconds that a user must wait before sending another message to the thread.

    Bots, as well as users with the manage_messages or manage_channel are unaffected

    Note

    This has to be between 0-21600 seconds.

  • reason (str | UndefinedType) – The reason to put in the audit log.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ThreadChannelData

async modify_user_voice_state(authentication, guild_id, channel_id, user_id, *, suppress=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the voice state of the bot

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • channel_id (Snowflake) – The id of a stage channel the user is in

  • user_id (Snowflake) – The user to modify the voice state for

  • suppress (bool | UndefinedType) –

    Whether to be in the audience.

    Note

    You need the MUTE_MEMBERS if you want to set this to False, however no permission is required to set it to False.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_webhook(authentication, webhook_id, *, name=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to modify

  • name (str | UndefinedType) – The new name of the webhook

  • avatar (str | None | UndefinedType) – Base64 encoded avatar of the webhook

  • channel_id (Snowflake | UndefinedType) – The id of a channel to move the webhook to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated webhook

Return type

discord_typings.WebhookData

async modify_webhook_with_token(webhook_id, webhook_token, *, name=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a webhook

Read the documentation

Parameters
  • webhook_id (Snowflake) – The id of the webhook to modify

  • webhook_token (str) – The token of the webhook to use for authentication

  • name (str | UndefinedType) – The new name of the webhook

  • avatar (str | None | UndefinedType) – Base64 encoded avatar of the webhook

  • channel_id (Snowflake | UndefinedType) – The id of a channel to move the webhook to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated webhook

Return type

discord_typings.WebhookData

async pin_message(authentication, channel_id, message_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Pins a message.

Read the documentation

Note

This requires the manage_messages permission.

Warning

This will fail if there is 50 or more messages pinned.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to pin the message in.

  • message_id (Snowflake) – The id of the message to pin.

  • reason (str | UndefinedType) –

    The reason to put in the audit log.

    Note

    This has to be between 1 and 512 characters.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_ban(authentication, guild_id, user_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Unbans a user from a guild

Read the documentation

Note

This requires the BAN_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of the guild to unban the member from

  • user_id (Snowflake) – The id of the user to unban

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_member(authentication, guild_id, user_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Removes a member from a guild

Read the documentation

Note

This requires the KICK_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of theguild to kick the member from

  • user_id (Snowflake) – The id of the user to kick

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_member_role(authentication, guild_id, user_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Removes a role from a member

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild where the member is located

  • user_id (Snowflake) – The id of the member to remove the role from

  • role_id (Snowflake) – The id of the role to remove

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Removes a member from a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Note

This requires the MANAGE_THREADS permission.

You can also be the owner of the thread if it is a private thread.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to add the member to.

  • user_id (str | int) – The id of the member to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async search_guild_members(authentication, guild_id, query, *, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Searches for members in the guild with a username or nickname that starts with query

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the members from

  • query (str) – What a members username or nickname has to start with to be included

  • limit (int | UndefinedType) –

    The amount of results to return

    Note

    This has to be between 1 and 10,000

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildMemberData]

async setup()#

Sets up the HTTP session

Warning

This has to be called before HTTPClient._request() or HTTPClient.connect_to_gateway()

Raises

RuntimeError – This can only be called once

Return type

None

async start_thread_from_message(authentication, channel_id, message_id, name, *, auto_archive_duration=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Starts a thread from a message.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to start the thread in.

  • message_id (Snowflake) – The id of the message to start the thread from.

  • name (str) – The name of the thread.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – The auto archive duration of the thread.

  • rate_limit_per_user (int | None | UndefinedType) –

    The time every member has to wait before sending another message.

    Note

    This has to be between 0 and 21600.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

ChannelData

async start_thread_without_message(authentication, channel_id, name, *, auto_archive_duration=UndefinedType.UNDEFINED, thread_type=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, invitable=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Starts a thread without a message

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The channel to create the thread in.

  • name (str) –

    The name of the thread.

    Note

    This has to be between 1-100 characters long.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – The time to automatically archive the thread after no activity.

  • rate_limit_per_user (int | None | UndefinedType) –

    The time every member has to wait before sending another message

    Note

    This has to be between 0 and 21600.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • thread_type (Literal[11, 12] | UndefinedType) –

  • reason (str | UndefinedType) –

  • invitable (bool | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The channel data.

Return type

ChannelData

async sync_guild_template(authentication, guild_id, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Updates a template with the updated-guild.

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id of the template

  • template_code (str) – The template to sync

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async trigger_typing_indicator(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Triggers a typing indicator.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to trigger the typing indicator on.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async unpin_message(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Unpins a message.

Read the documentation

Note

This requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to unpin the message in.

  • message_id (Snowflake) – The id of the message to unpin.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async update_auto_moderation_rule(authentication, guild_id, rule_id, *, name=UndefinedType.UNDEFINED, event_type=UndefinedType.UNDEFINED, trigger_type=UndefinedType.UNDEFINED, trigger_metadata=UndefinedType.UNDEFINED, actions=UndefinedType.UNDEFINED, enabled=UndefinedType.UNDEFINED, exempt_roles=UndefinedType.UNDEFINED, exempt_channels=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, global_priority=0, bucket_priority=0, wait=True)#

Update an auto moderation rule.

Read the documentation

Note

This requires the MANAGE_GUILD permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild that the auto moderation rule is in.

  • rule_id (Snowflake) – The auto moderation rule id.

  • name (str | UndefinedType) – The name of the auto moderation rule.

  • event_type (discord_typings.AutoModerationEventTypes | UndefinedType) – The event type of the auto moderation rule.

  • trigger_type (discord_typings.AutoModerationTriggerTypes | UndefinedType) – The trigger type of the auto moderation rule.

  • trigger_metadata (discord_typings.AutoModerationTriggerMetadataData | UndefinedType) – The trigger metadata of the auto moderation rule.

  • actions (list[AutoModerationActionData] | UndefinedType) – The actions to do when this rule got triggered.

  • enabled (bool | UndefinedType) – Whether the rule is enabled.

  • exempt_roles (list[Snowflake] | UndefinedType) – The roles that are exempt from this rule.

  • exempt_channels (list[Snowflake] | UndefinedType) – The channels that are exempt from this rule.

  • reason (str) –

    A reason for the audit log.

    Note

    This must be in 1 and 512 characters.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

Return type

AutoModerationRuleData

class nextcore.http.Route(method, path, *, ignore_global=False, guild_id=None, channel_id=None, webhook_id=None, webhook_token=None, **parameters)#

Metadata about a discord API route

Parameters
  • method (Literal['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH']) – The HTTP method of the route

  • path (LiteralString) – The path of the route. This can include python formatting strings ({var_here}) from kwargs

  • ignore_global (bool) – If this route bypasses the global rate limit.

  • guild_id (Snowflake | None) –

  • channel_id (Snowflake | None) –

  • webhook_id (Snowflake | None) –

  • webhhook_token – Major parameters which will be included in parameters and count towards the rate limit.

  • parameters (Snowflake) –

    The parameters of the route. These will be used to format the path.

    This will be included in Route.bucket

  • webhook_token (str | None) –

Return type

None

method#

The HTTP method of the route

route#

The path of the route. This can include python formatting strings ({var_here}) from kwargs.

path#

The formatted version of Route.route

ignore_global#

If this route bypasses the global rate limit.

This is always True for unauthenticated routes.

bucket#

The rate limit bucket this fits in.

This is created from Route.guild_id, Route.channel_id, Route.webhook_id, Bucket.method and Route.path

class nextcore.http.RateLimitStorage#

Storage for rate limits for a user.

One of these should be created for each user.

Note

This will register a gc callback to clean up the buckets.

Return type

None

global_lock#

The users per user global rate limit.

async close()#

Clean up before deletion.

Warning

If this is not called before you delete this or it goes out of scope, you will get a memory leak.

Return type

None

async get_bucket_by_discord_id(discord_id)#

Get a rate limit bucket from the Discord bucket hash.

This can be obtained via the X-Ratelimit-Bucket header.

Parameters

discord_id (str) – The Discord bucket hash

Return type

Bucket | None

async get_bucket_by_nextcore_id(nextcore_id)#

Get a rate limit bucket from a nextcore created id.

Parameters

nextcore_id (str) – The nextcore generated bucket id. This can be gotten by using Route.bucket

Return type

Bucket | None

async get_bucket_metadata(bucket_route)#

Get the metadata for a bucket from the route.

Parameters

bucket_route (str) – The bucket route.

Return type

BucketMetadata | None

async store_bucket_by_discord_id(discord_id, bucket)#

Store a rate limit bucket by the discord bucket hash.

This can be obtained via the X-Ratelimit-Bucket header.

Parameters
  • discord_id (str) – The Discord bucket hash

  • bucket (Bucket) – The bucket to store.

Return type

None

async store_bucket_by_nextcore_id(nextcore_id, bucket)#

Store a rate limit bucket by nextcore generated id.

Parameters
  • nextcore_id (str) – The nextcore generated id of the

  • bucket (Bucket) – The bucket to store.

Return type

None

async store_metadata(bucket_route, metadata)#

Store the metadata for a bucket from the route.

Parameters
  • bucket_route (str) – The bucket route.

  • metadata (BucketMetadata) – The metadata to store.

Return type

None

class nextcore.http.Bucket(metadata)#

A discord rate limit implementation around a bucket.

Parameters

metadata (BucketMetadata) – The metadata for the bucket.

metadata#

The metadata for the bucket.

acquire(*, priority=0, wait=True)#

Use a spot in the rate limit.

Parameters
  • priority (int) – The priority of a request. A lower number means it will be executed faster.

  • wait (bool) –

    Wait for a spot in the rate limit.

    If this is set to False, this will raise RateLimitedError if no spot is available right now.

Raises

RateLimitedError – You are rate limited and wait was set to False

Return type

AsyncIterator[None]

property dirty: bool#

Whether the bucket is currently any different from a clean bucket created from a BucketMetadata.

class nextcore.http.BucketMetadata(limit=None, *, unlimited=False)#

Metadata about a discord bucket.

Parameters
  • limit (int | None) – The maximum number of requests that can be made in the given time period.

  • unlimited (bool) – Whether the bucket has an unlimited number of requests. If this is True, limit has to be None.

Return type

None

limit#

The maximum number of requests that can be made in the given time period.

Note

This will be None if BucketMetadata.unlimited is True.

This will also be None if no limit has been fetched yet.

unlimited#

Wheter the bucket has no rate limiting enabled.

class nextcore.http.RequestSession(*, priority=0, unlimited=False)#

A metadata class about a pending request. This is used by Bucket

Parameters
  • unlimited (bool) –

    If this request was made when the bucket was unlimited.

    This exists to make sure that there is no bad state when switching between unlimited and limited.

  • priority (int) –

Return type

None

unlimited#

If this request was made when the bucket was unlimited.

This exists to make sure that there is no bad state when switching between unlimited and limited.

pending_future#

The future that when set will execute the request.

class nextcore.http.BaseGlobalRateLimiter#

A base implementation of a rate-limiter for global-scoped rate-limits.

Warning

This does not contain any implementation!

You are probably looking for LimitedGlobalRateLimiter or UnlimitedGlobalRateLimiter

abstract acquire(*, priority=0, wait=True)#

Use a spot in the rate-limit.

Parameters
  • priority (int) –

    Warning

    This can safely be ignored.

    The request priority. Lower number means it will be requested earlier.

  • wait (bool) –

    Whether to wait for a spot in the rate limit.

    If this is set to False, this will raise a RateLimitedError

Returns

A context manager that will wait in __aenter__ until a request should be made.

Return type

typing.AsyncContextManager

abstract update(retry_after)#

Updates the rate-limiter with info from a global scoped 429.

Parameters

retry_after (float) –

The time from the retry_after field in the JSON response or the retry_after header.

Hint

The JSON field has more precision than the header.

Return type

None

class nextcore.http.LimitedGlobalRateLimiter(limit=50)#

A limited global rate-limiter.

Parameters

limit (int) – The amount of requests that can be made per second.

Return type

None

update(retry_after)#

A function that gets called whenever the global rate-limit gets exceeded

This just makes a warning log.

Parameters

retry_after (float) –

Return type

None

class nextcore.http.UnlimitedGlobalRateLimiter#

A global rate-limiting implementation

This works by allowing infinite requests until one fail, and when one fails stop further requests from being made until retry_after is done.

Warning

This may cause a lot of 429’s. Please use LimitedGlobalRateLimiter unless you are sure you need this.

Warning

This is slower than other implementations due to using Discord’s time.

There is some extra delay due to ping due to this.

Return type

None

acquire(*, priority=0, wait=True)#

Acquire a spot in the rate-limit

Parameters
  • priority (int) –

    Warning

    Request priority currently does nothing.

  • wait (bool) –

    Whether to wait for a spot in the rate limit.

    If this is False, this will raise RateLimitedError instead.

Raises

RateLimitedErrorwait was set to False and we are rate limited.

Returns

A context manager that will wait in __aenter__ until a request should be made.

Return type

typing.AsyncContextManager

update(retry_after)#

Updates the rate-limiter with info from a global scoped 429.

Parameters

retry_after (float) –

The time from the retry_after field in the JSON response or the retry_after header.

Hint

The JSON field has more precision than the header.

Return type

None

class nextcore.http.File(name, contents)#

A utility class for uploading files to the API.

Parameters
  • name (str) –

    The name of the file.

    Warning

    Only files ending with a supported file extension can be included in embeds.

  • contents (Contents) – The contents of the file.

Return type

None

name#

The name of the file.

Warning

Only files ending with a supported file extension can be included in embeds.

contents#

The contents of the file.

HTTP Wrappers#

class nextcore.http.ApplicationCommandsHTTPWrappers#

HTTP wrappers for application commands API endpoints.

This is an abstract base class that should not be used directly.

async bulk_overwrite_global_application_commands(authentication, application_id, *commands, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a global application command

Read the documentation

Warning

This will replace all your global commands. Include the old commands to keep them

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • commands (ApplicationCommandPayload) –

    The global commands to overwrite the current global commands with

    Note

    Some fields have additional restrictions. See HTTPClient.create_global_application_command()’s arguments for more information.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The global commands

Return type

list[discord_typings.ApplicationCommandData]

async bulk_overwrite_guild_application_commands(authentication, application_id, guild_id, *commands, bucket_priority=0, global_priority=0, wait=True)#

Bulk overwrite guild commands

Read the documentation

Warning

This will replace all your global commands. Include the old commands to keep them

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The guild to overwrite commands in

  • commands (ApplicationCommandPayload) –

    The commands to overwrite the current commands with

    Note

    There is some extra limits. See the params of HTTPClient.edit_guild_application_command() for more info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The new commands

Return type

list[discord_typings.ApplicationCommandData]

async create_global_application_command(authentication, application_id, name, description, *, name_localizations=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, dm_permission=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a global application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • name (str) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • dm_permission (bool | None | UndefinedType) –

    Whether the command can be used in DMs.

    Note

    If this is UNDEFINED, it defaults to True.

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The command that was created

Return type

discord_typings.ApplicationCommandData

async create_guild_application_command(authentication, application_id, guild_id, name, description, *, name_localizations=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates or updates a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The guild to add the command to

  • name (str) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The command that was created

Return type

discord_typings.ApplicationCommandData

async delete_followup_message(application_id, interaction_token, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a response sent to a interaction by message id

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • message_id (Snowflake) – The id of the message to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

MessageData

async delete_global_application_command(authentication, application_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a global command

Read the documentation

Raises
Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Return type

None

async delete_guild_application_command(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • guild_id (Snowflake) – The guild where the command is located in

  • command_id (Snowflake) – The command to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_original_interaction_response(application_id, interaction_token, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes the first response sent to a interaction

Read the documentation

Note

You can not delete ephemeral responses

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async edit_global_application_command(authentication, application_id, command_id, *, name=UndefinedType.UNDEFINED, name_localizations=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, dm_permission=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a global application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • name (str | UndefinedType) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str | UndefinedType) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • dm_permission (bool | None | UndefinedType) –

    Whether the command can be used in DMs.

    Note

    If this is UNDEFINED, it defaults to True.

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The command that was edited

Return type

discord_typings.ApplicationCommandData

async edit_guild_application_command(authentication, application_id, guild_id, command_id, *, name=UndefinedType.UNDEFINED, name_localizations=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, description_localizations=UndefinedType.UNDEFINED, options=UndefinedType.UNDEFINED, default_member_permissions=UndefinedType.UNDEFINED, type=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a guild application command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only update commands for your current application

  • guild_id (Snowflake) – The id of the guild where the command is located in

  • name (str | UndefinedType) –

    The name of the command

    Note

    If the name is already taken by a existing application command with the same name and type it will update the exisiting command.

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • name_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the name

    Note

    This has to be between 1-32 characters long and follow the naming conventions

  • description (str | UndefinedType) –

    The description of the command

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • description_localizations (dict[Locales, str] | None | UndefinedType) –

    The localizations for the description

    Note

    This has to be between 1-100 characters long

    Warning

    Some special characters may be automatically removed from this!

  • options (list[ApplicationCommandOptionData] | UndefinedType) –

    The parameters or sub-commands of the command

    Note

    This should only be provide

  • default_member_permissions (str | None | UndefinedType) – The default permissions to require to use the command

  • type (Literal[1, 2, 3] | UndefinedType) –

    The type of the command

    Note

    This defaults to 1 if it is UNDEFINED.

    Possible values - 1: Slash/text command - 2: User context menu - 3: Message context menu

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The command that was edited

Return type

discord_typings.ApplicationCommandData

async get_application_command_permissions(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets permissions for a command in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • command_id (Snowflake) – The id of the command to fetch

  • guild_id (Snowflake) – The guild to get permissions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The application command permissions overwrites for the command

Return type

discord_typings.GuildApplicationCommandPermissionData

async get_followup_message(application_id, interaction_token, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a response sent to a interaction by message id

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • message_id (Snowflake) – The id of the message to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was fetched

Return type

discord_typings.MessageData

async get_global_application_command(authentication, application_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a global command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The global commmand fetched

Return type

discord_typings.ApplicationCommandData

async get_global_application_commands(authentication, application_id, *, with_localizations=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all global commands

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_localizations (bool | UndefinedType) –

Raises
Returns

The global commmands registered to the application

Return type

list[discord_typings.ApplicationCommandData]

async get_guild_application_command(authentication, application_id, guild_id, command_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a guild command

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • guild_id (Snowflake) – The guild to get the command from

  • application_id – The id of the command to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • command_id (Snowflake) –

Raises
Returns

The global commmand fetched

Return type

discord_typings.ApplicationCommandData

async get_guild_application_command_permissions(authentication, application_id, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all application command permissions in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • application_id – The id of the command to fetch

  • guild_id (Snowflake) – The guild to get permissions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The application command permissions overwrites in the guild

Return type

list[discord_typings.GuildApplicationCommandPermissionData]

async get_guild_application_commands(authentication, application_id, guild_id, *, with_localizations=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all commands in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • guild_id (Snowflake) – The guild to get commands from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_localizations (bool | UndefinedType) –

Raises
Returns

The commmands registered to the guild

Return type

list[discord_typings.ApplicationCommandData]

async get_original_interaction_response(application_id, interaction_token, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the first response sent to a interaction

Read the documentation

Parameters
  • application_id (Snowflake) –

    The application id/client id of the current application

    Note

    You can only get commands for your current application

  • interaction_token (str) – The token of the interaction

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • aiohttp.ClientConnectorError – Could not connect due to a problem with your connection

  • UnauthorizedError – A invalid token was provided

  • NotFoundError – You have not responded or the response was ephemeral or a defer that has not been completed yet.

Returns

The message

Return type

discord_typings.MessageData

class nextcore.http.AuditLogHTTPWrappers#

HTTP wrappers for audit log API endpoints.

This is an abstract base class that should not be used directly.

async get_guild_audit_log(authentication: BotAuthentication, guild_id: Snowflake, *, user_id: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', action_type: AuditLogEvents | UndefinedType = 'UNDEFINED', before: nextcore.common.undefined.UndefinedType = 'UNDEFINED', after: int, limit: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') AuditLogData#
async get_guild_audit_log(authentication: BotAuthentication, guild_id: Snowflake, *, user_id: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', action_type: AuditLogEvents | UndefinedType = 'UNDEFINED', before: int, after: nextcore.common.undefined.UndefinedType = 'UNDEFINED', limit: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') AuditLogData
async get_guild_audit_log(authentication: BotAuthentication, guild_id: Snowflake, *, user_id: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', action_type: AuditLogEvents | UndefinedType = 'UNDEFINED', before: nextcore.common.undefined.UndefinedType = 'UNDEFINED', after: nextcore.common.undefined.UndefinedType = 'UNDEFINED', limit: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') AuditLogData

Gets the guild audit log.

Read the documentation

Note

This requires the VIEW_AUDIT_LOG permission.

Parameters
  • authentication – Authentication info.

  • guild_id – The guild to query the audit log for.

  • user_id

    The user to filter the audit log by.

    This will be the user that did the action if present, if not it will be the user that got actioned.

  • action_type – The action type to filter the audit log by.

  • before

    Get entries before this entry.

    Note

    This does not have to be a valid entry id.

  • after

    Get entries before after entry.

    Note

    This does not have to be a valid entry id.

  • limit

    The amount of entries to get.

    Note

    This has a minimum of 1 and a maximum of 100.

    Note

    This defaults to 50.

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The guild audit log.

Hint

A list of fields are available in the documentation.

Return type

AuditLogData

class nextcore.http.ChannelHTTPWrappers#

HTTP wrappers for channel API endpoints.

This is an abstract base class that should not be used directly.

async add_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Adds a member to a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to add the member to.

  • user_id (str | int) – The id of the member to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async bulk_delete_messages(authentication, channel_id, messages, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes multiple messages.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_DELETE_BULK dispatch event.

Warning

This will not delete messages older than two weeks.

If any of the messages provided are older than 2 weeks this will error.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • messages (list[str] | list[int] | list[Snowflake]) –

    The ids of the messages to delete.

    Note

    This has to be between 2 and 100 messages.

    Invalid messages still count towards the limit.

  • reason (str | UndefinedType) –

    The reason for deleting the message.

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async create_channel_invite(authentication: BotAuthentication, channel_id: Snowflake, *, max_age: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', max_uses: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', temporary: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', unique: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_type: Literal[0], target_user_id: Snowflake, target_application_id: nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') InviteData#
async create_channel_invite(authentication: BotAuthentication, channel_id: Snowflake, *, max_age: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', max_uses: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', temporary: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', unique: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_type: Literal[1], target_user_id: nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_application_id: Snowflake, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') InviteData
async create_channel_invite(authentication: BotAuthentication, channel_id: Snowflake, *, max_age: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', max_uses: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', temporary: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', unique: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_type: nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_user_id: nextcore.common.undefined.UndefinedType = 'UNDEFINED', target_application_id: nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') InviteData

Creates an invite for a channel.

Read the documentation

Parameters
  • authentication – Authentication info.

  • channel_id – The id of the channel to create an invite for.

  • max_age

    How long the invite should last.

    Note

    This has to be between 0 and 604800 seconds. (7 days)

    Setting this to 0 will make it never expire.

  • max_uses – How many times the invite can be used before getting deleted.

  • temporary

    Whether the invite grants temporary membership.

    This will kick members if they havent got a role when logging off.

  • unique – Whether discord will make a new invite regardless of existing invites.

  • target_type

    The type of the target.

    • 0: A user’s stream

    • 1: EMBEDDED Activity

  • target_user_id

    The id of the user streaming to invite to.

    Note

    This can only be set if target_type is 0.

  • target_application_id

    The id of the EMBEDDED activity to play.

    Note

    This can only be set if target_type is 1.

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite data.

Return type

InviteData

async create_message(authentication, channel_id, *, content=UndefinedType.UNDEFINED, tts=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, message_reference=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, sticker_ids=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a message in a channel.

Read the documentation

Note

This requires the view_channel and send_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to create a message in.

  • content (str | UndefinedType) – The content of the message.

  • tts (bool | UndefinedType) –

    Whether the content should be spoken out by the Discord client upon send.

    Note

    This will still set Message.tts to True even if content is not provided.

  • embeds (list[EmbedData] | UndefinedType) –

    The embeds to send with the message.

    Hint

    The fields are in the Embed documentation.

    Note

    There is a maximum 6,000 character limit across all embeds.

    Read the embed limits documentation for more info.

  • allowed_mentions (AllowedMentionsData | UndefinedType) – The allowed mentions for the message.

  • message_reference (MessageReferenceData | UndefinedType) – The message to reply to.

  • components (list[ActionRowData] | UndefinedType) – The components to send with the message.

  • sticker_ids (list[int] | UndefinedType) –

    A list of sticker ids to attach to the message.

    Note

    This has a max of 3 stickers.

  • files (Iterable[File] | UndefinedType) – The files to send with the message.

  • attachments (list[AttachmentData] | UndefinedType) –

    Metadata about the files parameter.

    Note

    This only includes the filename and description fields.

  • flags (int | UndefinedType) –

    Bitwise flags to send with the message.

    Note

    Only the SUPRESS_EMBEDS flag can be set.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was sent.

Return type

discord_typings.MessageData

async create_reaction(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Creates a reaction to a message.

Read the documentation

Note

This requires the read_message_history permission.

This also requires the add_reactions permission if noone else has reacted to the message with this emoji.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to add a reaction to.

  • emoji (str) –

    The emoji to add to the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async crosspost_message(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Publishes a message in a news channel

Read the documentation

Note

This requires the send_messages permission when trying to crosspost a message sent by the current user.

If not this requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to crosspost the message to.

  • message_id (Snowflake) – The id of the message to crosspost.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was crossposted.

Return type

discord_typings.MessageData

async delete_all_reactions(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes all reactions from a message.

Read the documentation

Note

This requires the MANAGE_MESSAGES permission.

Note

This will cause a MESSAGE_REACTION_REMOVE_ALL dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove all reactions from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_all_reactions_for_emoji(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes all reactions from a message with a specific emoji.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_REACTION_REMOVE_EMOJI dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove all reactions from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_channel(authentication, channel_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel.

Read the documentation

Note

This requires the MANAGE_CHANNELS for channels and MANAGE_THREADS for threads

DMs does not require any permissions to close

Warning

Deleting a category will not delete the channels under it.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_channel_permission(authentication, channel_id, target_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel permission.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to delete the permission from.

  • target_id (Snowflake) – The id of the user or role to delete the permission from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_message(authentication, channel_id, message_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a message.

Read the documentation

Note

This requires the manage_messages permission.

Note

This will cause a MESSAGE_DELETE dispatch event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to delete.

  • reason (str | UndefinedType) –

    The reason for deleting the message.

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_own_reaction(authentication, channel_id, message_id, emoji, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a reaction from a message.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove a reaction from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async delete_user_reaction(authentication, channel_id, message_id, emoji, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a reaction from a message from another user.

Read the documentation

Note

This requires the manage_messages permission.

Note

This does not error when attempting to remove a reaction that does not exist.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to remove a reaction from.

  • emoji (str) –

    The emoji to remove from the message.

    This is either a unicode emoji or a custom emoji in the format name:id.

  • user_id (Snowflake) – The id of the user to remove the reaction from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

None

async edit_channel_permissions(authentication, channel_id, target_type, target_id, *, allow=UndefinedType.UNDEFINED, deny=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Edits the permissions of a channel.

Read the documentation

Note

This requires the manage_roles permission.

This also requires the permissions you want to grant/deny unless your bot has a manage_roles overwrite.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to edit.

  • target_type (Literal[0, 1]) –

    The type of the target.

    • 0: Role

    • 1: User

  • target_id (Snowflake) – The id of the target to edit permissions for.

  • allow (str | None | UndefinedType) –

    A bitwise flag of permissions to allow.

    Note

    If this is set to None, it will default to 0.

  • deny (str | None | UndefinedType) –

    A bitwise flag of permissions to allow.

    Note

    If this is set to None, it will default to 0.

  • reason (str | UndefinedType) –

    The reason to show in audit log

    Note

    If this is set to Undefined, there will be no reason.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async edit_message(authentication, channel_id, message_id, *, content=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Edits a message.

Read the documentation

Note

This requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to edit.

  • content (str | None | UndefinedType) –

    The new content of the message.

    Note

    If this is set to None, there will be no message contents.

    Note

    Adding/removing mentions will not affect mentions.

  • embeds (list[EmbedData] | None | UndefinedType) –

    The new embeds of the message.

    This overwrites the previous embeds

  • flags (int | None | UndefinedType) –

    The new flags of the message.

    Warning

    Only the SUPPRESS_EMBEDS flag can be set. Trying to set other flags will be ignored.

  • allowed_mentions (AllowedMentionsData | None | UndefinedType) –

    The new allowed mentions of the message.

    Note

    Setting this to None will make it use the default allowed mentions.

  • components (list[ActionRowData] | None | UndefinedType) – The new components of the message.

  • files (list[File] | None | UndefinedType) – The new files of the message.

  • attachments (list[AttachmentData] | None | UndefinedType) –

    The new attachments of the message.

    Warning

    This has to include previous and current attachments or they will be removed.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The edited message.

Return type

MessageData

async follow_news_channel(authentication, channel_id, webhook_channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Follows a news channel.

Read the documentation

Note

This requires the manage_webhooks permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to follow.

  • webhook_channel_id (Snowflake) – The id of the channel to receive posts to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The followed channel data.

Return type

FollowedChannelData

async get_channel(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a channel by ID.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The channel ID to get.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • aiohttp.ClientConnectorError – Could not connect due to a problem with your connection

  • UnauthorizedError – A invalid token was provided

  • NotFound – The channel could not be found

Returns

The channel.

Hint

A list of fields are available in the documentation.

Return type

ChannelData

async get_channel_invites(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the invites for a channel.

Read the documentation

Note

This requires the manage_channels permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get invites for.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invites for the channel.

Return type

list[InviteMetadata]

async get_channel_messages(authentication: BotAuthentication, channel_id: Snowflake, *, around: int, limit: int | nextcore.common.undefined.UndefinedType, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[MessageData]#
async get_channel_messages(authentication: BotAuthentication, channel_id: Snowflake, *, before: int, limit: int | nextcore.common.undefined.UndefinedType, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[MessageData]
async get_channel_messages(authentication: BotAuthentication, channel_id: Snowflake, *, after: int, limit: int | nextcore.common.undefined.UndefinedType, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[MessageData]
async get_channel_messages(authentication: BotAuthentication, channel_id: Snowflake, *, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[MessageData]

Gets messages from a channel.

Read the documentation

Note

This requires the view_channel permission..

Note

If the read_message_history permission is not given, this will return an empty list.

Parameters
  • authentication – Authentication info.

  • channel_id – The id of the channel to get messages from.

  • around

    The id of the message to get messages around.

    Note

    This does not have to be a valid message id.

  • before

    The id of the message to get messages before.

    Note

    This does not have to be a valid message id.

  • after

    The id of the message to get messages after.

    Note

    This does not have to be a valid message id.

  • limit

    The number of messages to get.

    Note

    This has to be between 1-100.

    Note

    If this is not provided it will default to 50.

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
async get_pinned_messages(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the pinned messages of a channel.

Read the documentation

Note

This requires the read_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get the pinned messages of.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The pinned messages.

Return type

list[discord_typings.MessageData]

async get_reactions(authentication, channel_id, message_id, emoji, *, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the reactions to a message.

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel where the message is located.

  • message_id (Snowflake) – The id of the message to get the reactions from.

  • emoji (str) – The emoji to get reactions for

  • after (Snowflake | UndefinedType) –

    A snowflake of that the reaction id has to be higher than to be included

    Note

    This does not have to be a valid snowflake

  • limit (int | UndefinedType) –

    The max amount of reactions to return

    Note

    This has to be between 1 and 100

    Note

    This defaults to 25

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The users that has reacted with this emoji.

Return type

list[UserData]

async get_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a thread member.

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to get from

  • user_id (str | int) – The member to get info from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
  • RateLimitedError – You are rate limited, and wait was set to False.

  • NotFoundError – The member is not part of the thread.

Return type

ThreadMemberData

async group_dm_add_recipient(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Adds a recipient to a group DM.

Read the documentation

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to add the recipient to.

  • user_id (Snowflake) – The id of the user to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async group_dm_remove_recipient(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Removes a recipient from a group DM.

Read the documentation

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to remove the recipient from.

  • user_id (Snowflake) – The id of the user to remove.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async join_thread(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Joins a thread.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The thread to join.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async leave_thread(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Leaves a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The channel to leave

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async list_joined_private_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List private archived threads the bot has joined.

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission.

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_private_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List private archived threads

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_public_archived_threads(authentication, channel_id, *, before=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

List public archived threads

Read the documentation

Note

This requires the READ_MESSAGE_HISTORY permission

Parameters
  • authentication (BotAuthentication) – Auth info.

  • channel_id (Snowflake) – The channel to get threads from

  • before (str | UndefinedType) – A ISO8601 timestamp of public threads to get after

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • limit (int | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_thread_members(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all thread members

Read the documentation

Warning

You need the GUILD_MEMBERS privileged intent!

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to get members from.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[ThreadMemberData]

async modify_group_dm(authentication, channel_id, *, name=UndefinedType.UNDEFINED, icon=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the group dm.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_guild_channel and HTTPClient.modify_thread.

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the group dm channel to update

  • name (str | UndefinedType) –

    The name of the group dm.

    Note

    This has to be between 1 to 100 characters long.

  • icon (str | None | UndefinedType) – A base64 encoded image of what to change the group dm icon to.

  • reason (str | UndefinedType) –

    A reason for the audit log.

    Note

    This has to be between 1 and 512 characters

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ChannelData

async modify_guild_channel(authentication, channel_id, *, name=UndefinedType.UNDEFINED, channel_type=UndefinedType.UNDEFINED, position=UndefinedType.UNDEFINED, topic=UndefinedType.UNDEFINED, nsfw=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, bitrate=UndefinedType.UNDEFINED, user_limit=UndefinedType.UNDEFINED, permission_overwrites=UndefinedType.UNDEFINED, parent_id=UndefinedType.UNDEFINED, rtc_region=UndefinedType.UNDEFINED, video_quality_mode=UndefinedType.UNDEFINED, default_auto_archive_duration=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guild channel.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_group_dm and HTTPClient.modify_thread.

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to update.

  • name (str | UndefinedType) – The name of the channel.

  • channel_type (Literal[0, 5] | UndefinedType) –

    The type of the channel.

    Note

    This is named type in the API, however to not overwrite the type function in python this is changed here.

  • position (int | None | UndefinedType) –

    The position of the channel.

    Note

    If this is set to None it will default to 0.

  • topic (str | None | UndefinedType) – The channel topic.

  • nsfw (bool | None | UndefinedType) –

    Whether the channel marked as age restricted.

    Note

    If this is set to None it will default to False.

  • rate_limit_per_user (int | None | UndefinedType) –

    How many seconds a user has to wait before sending another message or create a thread.

    Bots, as well as users with the manage_messages or manage_channel are unaffected A member can send one message and create one thread per period.

    Note

    This has to be between 0-21600 seconds.

  • bitrate (int | None | UndefinedType) –

    The bitrate of the channel in bits per second.

    Note

    This only works for stage / voice channels.

    Note

    This has to be between 8000-96000 for guilds without the VIP_REGIONS feature.

    For guilds with the VIP_REGIONS feature this has to be between 8000-128000.

  • user_limit (int | None | UndefinedType) – The maximum amount of users that can be in a voice channel at a time.

  • permission_overwrites (list[dict[Any, Any]] | None | UndefinedType) –

    The permission overwrites for the channel.

    Note

    If this is set to None it will default to an empty list.

  • parent_id (Snowflake | UndefinedType) –

    The id of the parent channel.

    This can be a text channel for threads or a category channel.

  • rtc_region (str | None | UndefinedType) –

    The voice region of the channel.

    Note

    If this is None it is automatic. Every time someone joins a empty channel, the closest region will be used.

  • video_quality_mode (Literal[1, 2] | None | UndefinedType) –

    The video quality mode of the channel.

    Note

    If this is None it will not be present in the Guild payload.

    This is rougly the same as setting it to 1.

  • default_auto_archive_duration (Literal[60, 1440, 4320, 10080] | None | UndefinedType) –

    The default auto archive duration for threads created in this channel.

    Note

    If this is None it will not be present in the Guild payload.

    The client treats this as it being set to 24 hours however this may change without notice.

  • reason (str | UndefinedType) – The reason to put in the audit log.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ChannelData

async modify_thread(authentication, thread_id, *, name=UndefinedType.UNDEFINED, archived=UndefinedType.UNDEFINED, auto_archive_duration=UndefinedType.UNDEFINED, locked=UndefinedType.UNDEFINED, invitable=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a thread.

Read the docoumentation

Warning

This shares rate limits with HTTPClient.modify_group_dm and HTTPClient.modify_guild_channel.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • thread_id (Snowflake) – The id of the thread to update.

  • name (str | UndefinedType) – The name of the thread.

  • archived (bool | UndefinedType) – Whether the thread is archived.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – How long in minutes to automatically archive the thread after recent activity

  • locked (bool | UndefinedType) – Whether the thread can only be un-archived by members with the manage_threads permission.

  • invitable (bool | UndefinedType) – Whether members without the manage_threads permission can invite members without the manage_channels permission to the thread.

  • rate_limit_per_user (int | UndefinedType) –

    The duration in seconds that a user must wait before sending another message to the thread.

    Bots, as well as users with the manage_messages or manage_channel are unaffected

    Note

    This has to be between 0-21600 seconds.

  • reason (str | UndefinedType) – The reason to put in the audit log.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Return type

ThreadChannelData

async pin_message(authentication, channel_id, message_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Pins a message.

Read the documentation

Note

This requires the manage_messages permission.

Warning

This will fail if there is 50 or more messages pinned.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to pin the message in.

  • message_id (Snowflake) – The id of the message to pin.

  • reason (str | UndefinedType) –

    The reason to put in the audit log.

    Note

    This has to be between 1 and 512 characters.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_thread_member(authentication, channel_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Removes a member from a thread

Read the documentation

Note

This will dispatch a THREAD_MEMBERS_UPDATE event.

Note

This requires the MANAGE_THREADS permission.

You can also be the owner of the thread if it is a private thread.

Parameters
  • authentication (BotAuthentication) – The auth info.

  • channel_id (Snowflake) – The thread to add the member to.

  • user_id (str | int) – The id of the member to add.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async start_thread_from_message(authentication, channel_id, message_id, name, *, auto_archive_duration=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Starts a thread from a message.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to start the thread in.

  • message_id (Snowflake) – The id of the message to start the thread from.

  • name (str) – The name of the thread.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – The auto archive duration of the thread.

  • rate_limit_per_user (int | None | UndefinedType) –

    The time every member has to wait before sending another message.

    Note

    This has to be between 0 and 21600.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

ChannelData

async start_thread_without_message(authentication, channel_id, name, *, auto_archive_duration=UndefinedType.UNDEFINED, thread_type=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, invitable=UndefinedType.UNDEFINED, rate_limit_per_user=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Starts a thread without a message

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The channel to create the thread in.

  • name (str) –

    The name of the thread.

    Note

    This has to be between 1-100 characters long.

  • auto_archive_duration (Literal[60, 1440, 4320, 10080] | UndefinedType) – The time to automatically archive the thread after no activity.

  • rate_limit_per_user (int | None | UndefinedType) –

    The time every member has to wait before sending another message

    Note

    This has to be between 0 and 21600.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • thread_type (Literal[11, 12] | UndefinedType) –

  • reason (str | UndefinedType) –

  • invitable (bool | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The channel data.

Return type

ChannelData

async trigger_typing_indicator(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Triggers a typing indicator.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to trigger the typing indicator on.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async unpin_message(authentication, channel_id, message_id, *, bucket_priority=0, global_priority=0, wait=True)#

Unpins a message.

Read the documentation

Note

This requires the manage_messages permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to unpin the message in.

  • message_id (Snowflake) – The id of the message to unpin.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

class nextcore.http.EmojiHTTPWrappers#

HTTP wrappers for emoji API endpoints.

This is an abstract base class that should not be used directly.

async delete_guild_emoji(authentication, guild_id, emoji_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Delete a emoji

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Note

This dispatches a GUILD_EMOJIS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to get the emoji from

  • emoji_id (int | str) – The emoji to get

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async get_guild_emoji(authentication, guild_id, emoji_id, *, bucket_priority=0, global_priority=0, wait=True)#

Get emoji info

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to get the emoji from

  • emoji_id (int | str) – The emoji to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async list_guild_emojis(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

List all emojis in a guild.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info

  • guild_id (Snowflake) – The guild to list emojis from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[EmojiData]

async modify_guild_emoji(authentication, guild_id, emoji_id, *, name=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modify a emoji

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Note

This dispatches a GUILD_EMOJIS_UPDATE event.

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the emoji is in

  • emoji_id (Snowflake) – The emoji to modify

  • name (str | UndefinedType) – The emoji name.

  • roles (list[Snowflake] | UndefinedType) – IDs of roles that can use this emoji.

  • reason (str | UndefinedType) – Reason to show in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

EmojiData

class nextcore.http.GatewayHTTPWrappers#

HTTP wrappers for gateway API endpoints.

This is an abstract base class that should not be used directly.

async get_gateway()#

Gets gateway connection info.

Read the documentation for more info.

Example usage:

gateway_info = await http_client.get_gateway()
Returns

The gateway info.

Return type

discord_typings.GetGatewayData

async get_gateway_bot(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets gateway connection information.

Read the documentation

Example usage:

bot_info = await http_client.get_gateway_bot(token)
Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Gateway connection info.

Return type

discord_typings.GetGatewayBotData

class nextcore.http.GuildScheduledEventHTTPWrappers#

HTTP wrappers for guild scheduled events API endpoints.

This is an abstract base class that should not be used directly.

async create_guild_scheduled_event(authentication: BotAuthentication, guild_id: Snowflake, name: str, privacy_level: Literal[2], scheduled_start_time: str, entity_type: Literal[3], *, entity_metadata: GuildScheduledEventEntityMetadata, scheduled_end_time: str, description: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', image: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') GuildScheduledEventData#
async create_guild_scheduled_event(authentication: BotAuthentication, guild_id: Snowflake, name: str, privacy_level: Literal[2], scheduled_start_time: str, entity_type: Literal[1, 2], *, channel_id: Snowflake, scheduled_end_time: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', description: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', image: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') GuildScheduledEventData

Create a scheduled event

Read the documentation

Parameters
  • authentication – Authentication info.

  • guild_id – The id of guild to create the scheduled event in

  • name – The name of the event

  • privacy_level

    Who can join the event

    Note

    This can currently only be 2

  • scheduled_start_time – A ISO8601 timestamp of when the event should start

  • entity_type

    What the event points to.

    Types: - 1: A stage channel - 2 A voice channnel - 3 A external link

  • channel_id – The channel the event is for

  • entity_metadata – Metadata about the event spesific to what entity_type you chose.

  • scheduled_end_time – A ISO8601 timestamp of when the event ends.

  • description – The description of the event.

  • image – A base64 encoded image to use as a cover.

  • reason – The reason to put in audit log

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The scheduled event that was created

Return type

discord_typings.GuildScheduledEventData

async delete_guild_scheduled_event(authentication, guild_id, guild_scheduled_event_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes scheduled event.

Read the documentation

Note

This requires the MANAGE_EVENTS guild permission.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the scheduled event is in

  • guild_scheduled_event_id (Snowflake) – The id of the event to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async get_guild_scheduled_event(authentication, guild_id, guild_scheduled_event_id, *, with_user_count=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets a scheduled event by id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild scheduled events from

  • guild_scheduled_event_id (Snowflake) – The id of the event to get.

  • with_user_count (bool | UndefinedType) – Include discord_typings.GuildScheduledEventData.user_count

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildScheduledEventData

async list_scheduled_events_for_guild(authentication, guild_id, *, with_user_count=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets all scheduled events for a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild scheduled events from

  • with_user_count (bool | UndefinedType) – Include discord_typings.GuildScheduledEventData.user_count

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildScheduledEventData]

class nextcore.http.GuildTemplateHTTPWrappers#

HTTP wrappers for guild template API endpoints.

This is an abstract base class that should not be used directly.

async create_guild_from_guild_template(authentication, template_code, name, *, icon=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a guild from a template

Read the documentation

Warning

This will fail if the bot is in more than 10 guilds.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • template_code (str) – The template code to create the guild from

  • name (str) – The name of the guild

  • icon (str | UndefinedType) – Base64 encoded 128x128px image to set the guild icon to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guild created

Return type

discord_typings.GuildData

async create_guild_template(authentication, guild_id, name, *, description=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a template from a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild to create a template from

  • name (str) –

    The name of the template

    Note

    This has to be between 2 and 100 characters long.

  • description (str | UndefinedType) –

    The description of the template

    Note

    This has to be between 0 and 120 characters long.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guild created

Return type

discord_typings.GuildData

async delete_guild_template(authentication, guild_id, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a template

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id where the template is located

  • template_code (str) – The code of the template to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The deleted template

Return type

discord_typings.GuildTemplateData

async get_guild_template(authentication, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a template by code

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • template_code (str) – The template code to get the template from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The template you requested

Return type

discord_typings.GuildTemplateData

async get_guild_templates(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all templates in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id to get templates from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The templates in the guild

Return type

list[discord_typings.GuildTemplateData]

async modify_guild_template(authentication, guild_id, template_code, *, name=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Updates a template.

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id of the template

  • template_code (str) – The code of the template to modify

  • name (str | UndefinedType) –

    What to change the template name to

    Note

    This has to be between 2 and 100 characters long.

  • description (str | UndefinedType) –

    What to change the template description to.

    Note

    This has to be between 0 and 120 characters long.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async sync_guild_template(authentication, guild_id, template_code, *, bucket_priority=0, global_priority=0, wait=True)#

Updates a template with the updated-guild.

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The guild id of the template

  • template_code (str) – The template to sync

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

class nextcore.http.GuildHTTPWrappers#

HTTP wrappers for guild API endpoints.

This is an abstract base class that should not be used directly.

async add_guild_member(bot_authentication, user_authentication, guild_id, user_id, *, nick=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, mute=UndefinedType.UNDEFINED, deaf=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Adds a member to a guild

Read the documentation

Note

The bot requires the CREATE_INSTANT_INVITE permission.

Parameters
  • bot_authentication (BotAuthentication) – The bot to use to invite the user

  • user_authentication (BearerAuthentication) –

    The user to add to the guild.

    Note

    This requires the guilds.join scope.

  • guild_id (Snowflake) – The guild to add the user to

  • user_id (Snowflake) – The user to add to the guild.

  • nick (str | UndefinedType) –

    What to set the users nickname to.

    Note

    Setting this requires the MANAGE_NICKNAMES permission

  • roles (list[Snowflake] | UndefinedType) –

    Roles to assign to the user.

    Note

    Setting this requires the MANAGE_ROLES permission

  • mute (bool | UndefinedType) –

    Whether to server mute the user

    Note

    Setting this requires the MUTE_MEMBERS permission

  • deaf (bool | UndefinedType) –

    Whether to server deafen the user

    Note

    Setting this requires the DEAFEN_MEMBERS permission

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

  • discord_typings.GuildMemberData – The member was added to the guild

  • None – The member was already in the guild

Return type

GuildMemberData | None

async add_guild_member_role(authentication, guild_id, user_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Add a role to a member

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild where the member is located

  • user_id (Snowflake) – The id of the member to add the role to

  • role_id (Snowflake) – The id of the role to add.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async begin_guild_prune(authentication, guild_id, *, days=UndefinedType.UNDEFINED, compute_prune_count=UndefinedType.UNDEFINED, include_roles=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the amount of members that would be pruned

Read the documentation

Note

This requires the KICK_MEMBERS permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the prune count for

  • days (int | UndefinedType) –

    How many days a user has to be inactive for to get included in the prune count

    Note

    If this is UNDEFINED, this will default to 7.

  • include_roles (list[str] | UndefinedType) – IDs of roles to be pruned aswell as the default role.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • compute_prune_count (bool | UndefinedType) –

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[str, Any]

async create_guild(authentication, name, *, icon=UndefinedType.UNDEFINED, verification_level=UndefinedType.UNDEFINED, default_message_notifications=UndefinedType.UNDEFINED, explicit_content_filter=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, channels=UndefinedType.UNDEFINED, afk_channel_id=UndefinedType.UNDEFINED, afk_timeout=UndefinedType.UNDEFINED, system_channel_id=UndefinedType.UNDEFINED, system_channel_flags=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Create a guild

Read the documentation.

Note

This can only be used by bots in less than 10 guilds.

Note

This dispatches a GUILD_CREATE event

Parameters
  • authentication (BotAuthentication) – The auth info

  • name (str) – The guild name

  • icon (str | UndefinedType) – A base64 encoded 128x128px icon of the guild.

  • verification_level (Literal[0, 1, 2, 3, 4] | UndefinedType) – The guild verification level

  • default_message_notifications (Literal[0, 1] | UndefinedType) –

    The default message notification level

    • 0: All messages

    • 1: Only mentions

  • explicit_content_filter_level

    The explicit content filter level.

    • 0 Disabled

    • 1 Members without roles

    • 2 All members

  • roles (list[RoleData] | UndefinedType) –

    A list of roles to initially create.

    Hint

    The id here is just a placeholder and can be used other places in this payload to reference it.

    It will be replaced by a snowflake by Discord once it has been created

  • channels (list[PartialChannelData] | UndefinedType) –

    Channels to initially create

    Note

    Not providing this will create a default setup

    Hint

    The id here is just a placeholder and can be used other places in this payload to reference it.

    It will be replaced by a snowflake by Discord once it has been created

    Hint

    Overwrites can be created by using a placeholder in the target and using the same placeholder as a role id.

  • afk_channel_id (Snowflake | UndefinedType) – The voice channel afk members will be moved to when idle in voice chat.

  • afk_timeout (int | UndefinedType) – The time in seconds a member has to be idle in a voice channel to be moved to the afk_channel_id

  • system_channel_id (Snowflake | UndefinedType) – The id of the channel where guild notices such as welcome messages and boost events are posted

  • system_channel_flags (int | UndefinedType) – A bitwise flag deciding what messages to post in the system channel.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • explicit_content_filter (Literal[0, 1, 2] | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildData

async create_guild_ban(authentication, guild_id, user_id, *, delete_message_days=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Bans a user from a guild

Read the documentation

Note

This requires the BAN_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of the guild to ban the member from

  • user_id (Snowflake) – The id of the user to ban

  • delete_message_days (int | UndefinedType) – Delete all messages younger than delete_message_days days sent by the user.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async create_guild_role(authentication: BotAuthentication, guild_id: Snowflake, *, name: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', permissions: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', color: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', hoist: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', mentionable: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') RoleData#
async create_guild_role(authentication: BotAuthentication, guild_id: Snowflake, *, name: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', permissions: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', color: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', hoist: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', icon: str | None, mentionable: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') RoleData
async create_guild_role(authentication: BotAuthentication, guild_id: Snowflake, *, name: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', permissions: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', color: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', hoist: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', unicode_emoji: str | None, mentionable: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') RoleData

Creates a role

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication – The auth info

  • guild_id – The guild to create the role in

  • name – The name of the role

  • permissions – The permissions the role has

  • color – The color of the role

  • hoist – If the role will be split into a seperate section in the member list.

  • icon

    Base64 encoded image data of the role icon

    Note

    This requires the ROLE_ICONS guild feature.

  • unicode_emoji

    A unicode emoji to use for the role icon.

    Note

    This requires the ROLE_ICONS guild feature.

  • mentionable – Whether the role can be mentioned by members without the MENTION_EVERYONE permission.

  • reason – The reason to put in audit log

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The role that was created

Return type

discord_typings.RoleData

async delete_guild(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Deletes a guild

Read the documentation

Note

You have to be the guild owner to delete it.

Note

This dispatches a GUILD_DELETE event

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The id of the guild to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_integration(authentication, guild_id, integration_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a integration

Read the documentation

Note

This will delete any associated webhooks and kick any associated bots.

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the integration is located in

  • integration_id (Snowflake) – The id of the integration to delete

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_guild_role(authentication, guild_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a channel.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id – The id of the role to delete.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • guild_id (Snowflake) –

  • role_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async get_guild(authentication, guild_id, *, with_counts=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Get a guild by ID

Read the documentation

Parameters
  • authentication (BotAuthentication) – The authenticaton info.

  • guild_id (Snowflake) – The guild to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • with_counts (bool | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildData

async get_guild_ban(authentication, guild_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a ban

Read the documentation

Note

This requires the BAN_MEMBERS permission..

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get the ban from

  • user_id (Snowflake) – The user to get ban info for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

BanData

async get_guild_bans(authentication: BotAuthentication, guild_id: Snowflake, *, before: int, limit: int | nextcore.common.undefined.UndefinedType, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[BanData]#
async get_guild_bans(authentication: BotAuthentication, guild_id: Snowflake, *, after: int, limit: int | nextcore.common.undefined.UndefinedType, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[BanData]
async get_guild_bans(authentication: BotAuthentication, guild_id: Snowflake, *, bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') list[BanData]

Gets a list of bans in a guild.

Read the documentation

Note

This requires the BAN_MEMBERS permission..

Parameters
  • authentication – Authentication info.

  • guild_id – The id of the guild to get bans from

  • before

    Do not return bans from users with a id more than this.

    Note

    This does not have to be a id of a existing user.

  • after

    Do not return bans from users with a id less than this.

    Note

    This does not have to be a id of a existing user.

  • limit

    The number of bans to get.

    Note

    This has to be between 1-100.

    Note

    If this is not provided it will default to 50.

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

async get_guild_channels(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all channels in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild to get channels from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[ChannelData]

async get_guild_integrations(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets guild integrations

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get integrations for

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • global_priority (int) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[IntegrationData]

async get_guild_invites(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all guild invites

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get invites for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[InviteMetadata]

async get_guild_member(authentication, guild_id, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the member from

  • user_id (str | int) – The user to get the member from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildMemberData

async get_guild_preview(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a guild preview by ID

Read the documentation

Note

If the bot is not in the guild, it needs the LURKABLE feature.

Parameters
  • authentication (BotAuthentication) – The authentication info

  • guild_id (Snowflake) – The id of the guild to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildPreviewData

async get_guild_prune_count(authentication, guild_id, *, days=UndefinedType.UNDEFINED, include_roles=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the amount of members that would be pruned

Read the documentation <https://discord.dev/resources/guild#get-guild-prune-count>

Note

This requires the KICK_MEMBERS permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the prune count for

  • days (int | UndefinedType) –

    How many days a user has to be inactive for to get included in the prune count

    Note

    If this is UNDEFINED, this will default to 7.

  • include_roles (list[str] | UndefinedType) – IDs of roles to be pruned aswell as the default role.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[str, Any]

async get_guild_roles(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all roles in a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to get the roles from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The roles in the guild

Return type

list[discord_typings.RoleData]

async get_guild_vanity_url(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the vanity invite from a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async get_guild_voice_regions(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets voice regions for a guild.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get voice regions from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[VoiceRegionData]

async get_guild_welcome_screen(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the welcome screen for a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the welcome screen for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

WelcomeScreenData

async get_guild_widget(guild_id)#

Gets a widget from a guild id

Read the documentation

Parameters

guild_id (Snowflake) – The id of guild to get the widget for.

Return type

GuildWidgetData

async get_guild_widget_settings(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets widget settings for a guild

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the widget settings for

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async list_active_guild_threads(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

List active guild threads

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get threads from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

HasMoreListThreadsData

async list_guild_members(authentication, guild_id, *, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Lists members in a guild

Read the documentation

Note

This requires the GUILD_MEMBERS intent enabled in the developer portal

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the members from

  • after (int | UndefinedType) –

    What a members id has to be above for them to be returned.

    Hint

    This is usually the highest user id in the previous page.

    Note

    This defaults to 0

  • limit (int | UndefinedType) –

    How many members to return per page

    Note

    This defaults to 1

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildMemberData]

async modify_current_member(authentication, guild_id, *, nick=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the member to update is in.

  • nick (str | None | UndefinedType) –

    What to change the users nickname to.

    Note

    Setting it to None will remove the nickname.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The member after the update

Return type

discord_typings.GuildMemberData

async modify_current_user_voice_state(authentication, guild_id, channel_id, *, suppress=UndefinedType.UNDEFINED, request_to_speak_timestamp=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the voice state of the bot

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • channel_id (Snowflake) – The id of a stage channel the bot is in

  • suppress (bool | UndefinedType) –

    Whether to be in the audience.

    Note

    You need the MUTE_MEMBERS if you want to set this to False, however no permission is required to set it to False.

  • request_to_speak_timestamp (str | None | UndefinedType) –

    A timestamp of when a user requested to speak.

    Note

    There is no validation if this is in the future or the past.

    Note

    You need the REQUEST_TO_SPEAK to set this to a non-None value, however setting it to None requires no permission.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_guild_channel_positions(authentication, guild_id, *position_updates, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies channel positions

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild to modify channel positions in.

  • position_updates (ChannelPositionData) – The position updates to do.

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async modify_guild_member(authentication, guild_id, user_id, *, nick=UndefinedType.UNDEFINED, roles=UndefinedType.UNDEFINED, mute=UndefinedType.UNDEFINED, deaf=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, communication_disabled_until=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a member

Read the documentation

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild where the member to update is in.

  • nick (str | None | UndefinedType) –

    What to change the users nickname to.

    Note

    Setting it to None will remove the nickname.

    Note

    Setting this requires the MANAGE_NICKNAMES permission

  • roles (list[Snowflake] | None | UndefinedType) –

    The roles the member has.

    Note

    Setting this requires the MANAGE_ROLES permission

  • mute (bool | None | UndefinedType) –

    Whether to server mute the user

    Note

    Setting this requires the MUTE_MEMBERS permission

  • deaf (bool | None | UndefinedType) –

    Whether to server deafen the user

    Note

    Setting this requires the DEAFEN_MEMBERS permission

  • channel_id (Snowflake | None | UndefinedType) –

    The channel to move the member to.

    Warning

    This will fail if the member is not in a voice channel

    Note

    Setting this requires having the VIEW_CHANNEL and CONNECT permissions in the channel_id channel, and the MOVE_MEMBERS permission

  • communication_disabled_until (str | None | UndefinedType) –

    A ISO8601 timestamp of When the member’s timeout will expire.

    Note

    This has to be under 28 days in the future.

    Note

    This requires the MODERATE_MEMBERS permission

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • user_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The member after the update

Return type

discord_typings.GuildMemberData

async modify_guild_role(authentication: BotAuthentication, guild_id: Snowflake, role_id: Snowflake, *, name: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', permissions: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', color: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', hoist: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', icon: str | None, mentionable: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') RoleData#
async modify_guild_role(authentication: BotAuthentication, guild_id: Snowflake, role_id: Snowflake, *, name: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', permissions: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', color: int | nextcore.common.undefined.UndefinedType = 'UNDEFINED', hoist: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', unicode_emoji: str | None, mentionable: bool | nextcore.common.undefined.UndefinedType = 'UNDEFINED', reason: str | nextcore.common.undefined.UndefinedType = 'UNDEFINED', bucket_priority: int = '0', global_priority: int = '0', wait: bool = 'True') RoleData

Modifies a role

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication – The auth info

  • guild_id – The guild where the role is located in

  • role_id – The role to modify

  • name – The name of the role

  • permissions – The permissions the role has

  • color – The color of the role

  • hoist – If the role will be split into a seperate section in the member list.

  • icon

    Base64 encoded image data of the role icon

    Note

    This requires the ROLE_ICONS guild feature.

  • unicode_emoji

    A unicode emoji to use for the role icon.

    Note

    This requires the ROLE_ICONS guild feature.

  • mentionable – Whether the role can be mentioned by members without the MENTION_EVERYONE permission.

  • reason – The reason to put in audit log

  • global_priority – The priority of the request for the global rate-limiter.

  • bucket_priority – The priority of the request for the bucket rate-limiter.

  • wait

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated role

Return type

discord_typings.RoleData

async modify_guild_role_positions(authentication, guild_id, *position_updates, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies role positions

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The guild to modify role positions in

  • position_updates (RolePositionData) – The positions to update

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[RoleData]

async modify_guild_welcome_screen(authentication, guild_id, *, enabled=UndefinedType.UNDEFINED, welcome_channels=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guilds welcome screen

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to modify the welcome screen for

  • enabled (bool | None | UndefinedType) – Whether the welcome screen is enabled

  • welcome_channels (list[WelcomeChannelData] | None | UndefinedType) – The channels to show on the welcome screen

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • description (str | None | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

WelcomeScreenData

async modify_guild_widget(authentication, guild_id, *, enabled=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a guilds widget settings

Read the documentation

Note

This requires the MANAGE_GUILD permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to modify the widget for

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • enabled (bool | UndefinedType) –

  • channel_id (Snowflake | None | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

GuildWidgetSettingsData

async modify_user_voice_state(authentication, guild_id, channel_id, user_id, *, suppress=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the voice state of the bot

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the vanity invite from

  • channel_id (Snowflake) – The id of a stage channel the user is in

  • user_id (Snowflake) – The user to modify the voice state for

  • suppress (bool | UndefinedType) –

    Whether to be in the audience.

    Note

    You need the MUTE_MEMBERS if you want to set this to False, however no permission is required to set it to False.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_ban(authentication, guild_id, user_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Unbans a user from a guild

Read the documentation

Note

This requires the BAN_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of the guild to unban the member from

  • user_id (Snowflake) – The id of the user to unban

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_member(authentication, guild_id, user_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Removes a member from a guild

Read the documentation

Note

This requires the KICK_MEMBERS permission and that the bot is higher in the role hierarchy than the member you are trying to kick

Parameters
  • authentication (BotAuthentication) – The auth info

  • guild_id (Snowflake) – The id of theguild to kick the member from

  • user_id (Snowflake) – The id of the user to kick

  • reason (str | UndefinedType) – The reason to put in the audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async remove_guild_member_role(authentication, guild_id, user_id, role_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Removes a role from a member

Read the documentation

Note

This requires the MANAGE_ROLES permission

Parameters
  • authentication (BotAuthentication) – The auth info.

  • guild_id (Snowflake) – The guild where the member is located

  • user_id (Snowflake) – The id of the member to remove the role from

  • role_id (Snowflake) – The id of the role to remove

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async search_guild_members(authentication, guild_id, query, *, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Searches for members in the guild with a username or nickname that starts with query

Read the documentation

Parameters
  • authentication (BotAuthentication) – Auth info.

  • guild_id (Snowflake) – The guild to get the members from

  • query (str) – What a members username or nickname has to start with to be included

  • limit (int | UndefinedType) –

    The amount of results to return

    Note

    This has to be between 1 and 10,000

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

list[GuildMemberData]

class nextcore.http.InviteHTTPWrappers#

HTTP wrappers for invite API endpoints.

This is an abstract base class that should not be used directly.

async delete_invite(authentication, invite_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a invite from a invite code

Read the documentation

Note

This requires the MANAGE_CHANNELS permission in the channel the invite is from or the MANAGE_GUILD permission.

Note

This will dispatch a INVITE_DELETE event.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • invite_code (str) – The code of the invite to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite that was deleted

Return type

discord_typings.InviteData

async get_invite(authentication, invite_code, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a invite from a invite code

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • invite_code (str) – The code of the invite to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The invite that was fetched

Return type

discord_typings.InviteData

class nextcore.http.OAuth2HTTPWrappers#

HTTP wrappers for OAuth2 API endpoints.

This is an abstract base class that should not be used directly.

async get_current_authorization_information(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the bots application

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Info about the current logged in user/bot

Return type

discord_typings.???

async get_current_bot_application_information(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the bots application

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The application the bot is connected to

Return type

discord_typings.ApplicationData

class nextcore.http.StageInstanceHTTPWrappers#

HTTP wrappers for stage instance API endpoints.

This is an abstract base class that should not be used directly.

async create_stage_instance(authentication, channel_id, topic, *, privacy_level=UndefinedType.UNDEFINED, send_start_notification=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to create a stage instance in

  • topic (str) –

    The topic of the stage instance

    Note

    This has to be between 1 and 120 characters.

  • privacy_level (Literal[1, 2] | UndefinedType) –

    The privacy level of the stage instance.

    Note

    This will default to 2/Guild only if not provided.

    Possible values - 1: Public (deprecated) - 2 Guild only

  • send_start_notification (bool | UndefinedType) –

    If you should send a notification to all members in the guild

    Note

    Setting this to True requires the MENTION_EVERYONE permission.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stage instance that was created.

Return type

discord_typings.StageInstanceData

async delete_stage_instance(authentication, channel_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to delete the stage instance for.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async get_stage_instance(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a stage instance from a stage channel id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The code of the invite to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stage instance that was fetched.

Return type

discord_typings.StageInstanceData

async modify_stage_instance(authentication, channel_id, *, topic=UndefinedType.UNDEFINED, privacy_level=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the stage channel to modify a stage instance in

  • topic (str | UndefinedType) –

    The topic of the stage instance

    Note

    This has to be between 1 and 120 characters.

  • privacy_level (Literal[1, 2] | UndefinedType) –

    The privacy level of the stage instance.

    Possible values - 1: Public (deprecated) - 2 Guild only

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated stage instance

Return type

discord_typings.StageInstanceData

class nextcore.http.StickerHTTPWrappers#

HTTP wrappers for sticker API endpoints.

This is an abstract base class that should not be used directly.

async delete_guild_sticker(authentication, guild_id, sticker_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a stage instance

Read the documentation

Note

This requires the MANAGE_CHANNELS, MUTE_MEMBERS and MOVE_MEMBERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id – The id of the stage channel to delete the stage instance for.

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • guild_id (Snowflake) –

  • sticker_id (Snowflake) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async get_guild_sticker(authentication, guild_id, sticker_id, *, bucket_priority=0, global_priority=0, wait=True)#

Get a custom sticker

Read the documentation

Note

The user field will be provided if you have the MANAGE_EMOJIS_AND_STICKERS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get the sticker from

  • sticker_id (str | int) – The sticker to get

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stickers in the guild

Return type

list[discord_typings.StickerData]

async get_sticker(authentication, sticker_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a sticker from a sticker id.

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • sticker_id (Snowflake) – The id of the sticker to get.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The sticker that was fetched

Return type

discord_typings.StickerData

async list_guild_stickers(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all custom stickers added by a guild

Read the documentation

Note

The user field will be provided if you have the MANAGE_EMOJIS_AND_STICKERS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of guild to get stickers from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The stickers in the guild

Return type

list[discord_typings.StickerData]

async list_nitro_sticker_packs(*, bucket_priority=0, global_priority=0, wait=True)#

Gets all nitro sticker packs

Read the documentation

Parameters
  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

dict[Literal[‘sticker_packs’], list[StickerPackData]]

async modify_guild_sticker(authentication, guild_id, sticker_id, *, name=UndefinedType.UNDEFINED, description=UndefinedType.UNDEFINED, tags=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a sticker

Read the documentation

Note

This requires the MANAGE_EMOJIS_AND_STICKERS permission.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild where the sticker is in.

  • sticker_id (Snowflake) – The id of the sticker to update

  • name (str | UndefinedType) –

    The name of the sticker.

    Note

    This has to be between 2 and 30 characters

  • description (str | UndefinedType) –

    The description of the sticker

    Note

    This has to be between 2 and 100 characters

  • tags (list[str] | UndefinedType) – Autocomplete/suggestion tags for the sticker (max 200 characters)

  • reason (str | UndefinedType) – The reason to put in audit log

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated stage instance

Return type

discord_typings.StageInstanceData

class nextcore.http.UserHTTPWrappers#

HTTP wrappers for user API endpoints.

This is an abstract base class that should not be used directly.

async create_dm(authentication, recipient_id, *, bucket_priority=0, global_priority=0, wait=True)#

Creates a DM channel

Read the documentation

Warning

You should not use this endpoint to DM everyone in a server about something. DMs should generally be initiated by a user action.

If you open a significant amount of DMs too quickly, your bot may be blocked from opening new ones.

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • recipient_id (Snowflake) – The id of user to DM.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The DM channel created/fetched.

Return type

discord_typings.DMChannelData

async get_current_user(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the current user

Read the documentation

Note

If you are using BearerAuthentication you need the IDENTIFY scope.

UserData.email will only be provided if you have the EMAIL scope.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current user

Return type

discord_typings.UserData

async get_current_user_guild_member(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the current users member in a guild

Read the documentation

Note

This requires the guilds.members.read scope

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get the member in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current member

Return type

discord_typings.GuildMemberData

async get_current_user_guilds(authentication, *, before=UndefinedType.UNDEFINED, after=UndefinedType.UNDEFINED, limit=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets the guilds the current user is in

Read the documentation

Note

If you are using BearerAuthentication you need the guilds scope.

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • before (Snowflake | UndefinedType) –

    Get guilds before this id

    Note

    This does not have to be a valid id.

  • after (Snowflake | UndefinedType) –

    Get guilds after this id

    Note

    This does not have to be a valid id.

  • limit (int | UndefinedType) –

    The max amount of guilds to return

    Note

    This has to be between 1 and 200

    Note

    This defaults to 200

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The guilds fetched

Return type

list[discord_typings.PartialGuildData]

async get_user(authentication, user_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a user by id

Read the documentation

Parameters
  • authentication (BotAuthentication | BearerAuthentication) – Authentication info.

  • user_id (Snowflake) – The id of the user to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The user you fetched

Return type

discord_typings.UserData

async get_user_connections(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the users connections

Read the documentation

Note

This requires the connections scope

Parameters
  • authentication (BearerAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current member

Return type

discord_typings.GuildMemberData

async leave_guild(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Leave a guild

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to leave

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The current user

Return type

discord_typings.UserData

async modify_current_user(authentication, *, username=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies the current user

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • username (str | UndefinedType) – The username to update to

  • avatar (str | UndefinedType) – Base64 encoded image to change the current users avatar to

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated user

Return type

discord_typings.UserData

class nextcore.http.VoiceHTTPWrappers#

HTTP wrappers for voice API endpoints.

This is an abstract base class that should not be used directly.

async list_voice_regions(authentication, *, bucket_priority=0, global_priority=0, wait=True)#

Gets the users connections

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

Voice regions

Return type

list[discord_typings.VoiceRegionData]

class nextcore.http.WebhookHTTPWrappers#

HTTP wrappers for webhook API endpoints.

This is an abstract base class that should not be used directly.

async create_webhook(authentication, channel_id, name, *, avatar=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Creates a webhook

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to create a webhook in

  • name (str) –

    The name of the webhook

    Note

    This has to be between 1 and 80 characters.

    It has to follow the Discord nickname restrictions (with the exception of the length limit.)

  • avatar (str | None | UndefinedType) – Base64 encoded image avatar to use as the default avatar

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was created

Return type

discord_typings.WebhookData

async delete_webhook(authentication, webhook_id, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was deleted

Return type

discord_typings.WebhookData

async delete_webhook_message(webhook_id, webhook_token, message_id, *, thread_id=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a message sent by the webhook

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch a message from

  • webhook_token (str) – The token of the webhook

  • message_id (Snowflake) – The id of the message to fetch

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to fetch the message from

    Note

    This has to be a thread in the channel the webhook is in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Return type

None

async delete_webhook_with_token(webhook_id, webhook_token, *, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Deletes a webhook

Read the documentation

Parameters
  • webhook_id (Snowflake) – The id of the webhook to delete

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • webhook_token (str) –

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async execute_webhook(authentication, webhook_id, webhook_token, *, discord_wait=UndefinedType.UNDEFINED, thread_id=UndefinedType.UNDEFINED, content=UndefinedType.UNDEFINED, username=UndefinedType.UNDEFINED, avatar_url=UndefinedType.UNDEFINED, tts=UndefinedType.UNDEFINED, embeds=UndefinedType.UNDEFINED, allowed_mentions=UndefinedType.UNDEFINED, message_reference=UndefinedType.UNDEFINED, components=UndefinedType.UNDEFINED, sticker_ids=UndefinedType.UNDEFINED, files=UndefinedType.UNDEFINED, attachments=UndefinedType.UNDEFINED, flags=UndefinedType.UNDEFINED, thread_name=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Sends a message to a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook.

  • webhook_token (str) –

    The token of the webhook.

    Warning

    You should keep this private!

  • discord_wait (bool | UndefinedType) – Whether to wait for the message to be fully sent on Discord’s end.

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to post the message in.

    Warning

    This will unarchive any thread

  • content (str | UndefinedType) – The content of the message.

  • username (str | UndefinedType) – The name of the user. If not provided this will use the webhook default

  • avatar_url (str | UndefinedType) – The url of the avatar. If not provided this will use the webhook default.

  • tts (bool | UndefinedType) –

    Whether the content should be spoken out by the Discord client upon send.

    Note

    This will still set Message.tts to True even if content is not provided.

  • embeds (list[EmbedData] | UndefinedType) –

    The embeds to send with the message.

    Hint

    The fields are in the Embed documentation.

    Note

    There is a maximum 6,000 character limit across all embeds.

    Read the embed limits documentation for more info.

  • allowed_mentions (AllowedMentionsData | UndefinedType) – The allowed mentions for the message.

  • message_reference (MessageReferenceData | UndefinedType) – The message to reply to.

  • components (list[ActionRowData] | UndefinedType) –

    The components to send with the message.

    Note

    The webhook must have been created by a bot for this to work.

  • sticker_ids (list[int] | UndefinedType) –

    A list of sticker ids to attach to the message.

    Note

    This has a max of 3 stickers.

  • files (Iterable[File] | UndefinedType) – The files to send with the message.

  • attachments (list[AttachmentData] | UndefinedType) –

    Metadata about the files parameter.

    Note

    This only includes the filename and description fields.

  • flags (int | UndefinedType) –

    Bitwise flags to send with the message.

    Note

    Only the SUPRESS_EMBEDS flag can be set.

  • thread_name (str | UndefinedType) –

    The name of the thread to create.

    Warning

    This can only be provided when the webhook is for a forum channel.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises
Returns

The message that was sent.

Return type

discord_typings.MessageData

async get_channel_webhooks(authentication, channel_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all webhooks in a channel

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • channel_id (Snowflake) – The id of the channel to get webhooks from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhooks in the channel

Return type

list[discord_typings.WebhookData]

async get_guild_webhooks(authentication, guild_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets all webhooks in a guild

Read the documentation

Note

This requires the MANAGE_WEBHOOKS permission

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • guild_id (Snowflake) – The id of the guild to get webhooks from

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhooks in the channel

Return type

list[discord_typings.WebhookData]

async get_webhook(authentication, webhook_id, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a webhook by webhook id

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async get_webhook_message(webhook_id, webhook_token, message_id, *, thread_id=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Gets a message sent by the webhook

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch a message from

  • webhook_token (str) – The token of the webhook

  • message_id (Snowflake) – The id of the message to fetch

  • thread_id (Snowflake | UndefinedType) –

    The id of the thread to fetch the message from

    Note

    This has to be a thread in the channel the webhook is in

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The message that was fetched

Return type

discord_typings.MessageData

async get_webhook_with_token(webhook_id, webhook_token, *, bucket_priority=0, global_priority=0, wait=True)#

Gets a webhook by webhook id and token

Read the documentation

Parameters
  • authentication – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to fetch

  • webhook_token (str) – The token of the webhook

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The webhook that was fetched

Return type

discord_typings.WebhookData

async modify_webhook(authentication, webhook_id, *, name=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a webhook

Read the documentation

Parameters
  • authentication (BotAuthentication) – Authentication info.

  • webhook_id (Snowflake) – The id of the webhook to modify

  • name (str | UndefinedType) – The new name of the webhook

  • avatar (str | None | UndefinedType) – Base64 encoded avatar of the webhook

  • channel_id (Snowflake | UndefinedType) – The id of a channel to move the webhook to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated webhook

Return type

discord_typings.WebhookData

async modify_webhook_with_token(webhook_id, webhook_token, *, name=UndefinedType.UNDEFINED, avatar=UndefinedType.UNDEFINED, channel_id=UndefinedType.UNDEFINED, reason=UndefinedType.UNDEFINED, bucket_priority=0, global_priority=0, wait=True)#

Modifies a webhook

Read the documentation

Parameters
  • webhook_id (Snowflake) – The id of the webhook to modify

  • webhook_token (str) – The token of the webhook to use for authentication

  • name (str | UndefinedType) – The new name of the webhook

  • avatar (str | None | UndefinedType) – Base64 encoded avatar of the webhook

  • channel_id (Snowflake | UndefinedType) – The id of a channel to move the webhook to.

  • global_priority (int) – The priority of the request for the global rate-limiter.

  • bucket_priority (int) – The priority of the request for the bucket rate-limiter.

  • wait (bool) –

    Wait when rate limited.

    This will raise RateLimitedError if set to False and you are rate limited.

  • reason (str | UndefinedType) –

Raises

RateLimitedError – You are rate limited, and wait was set to False

Returns

The updated webhook

Return type

discord_typings.WebhookData

HTTP errors#

exception nextcore.http.RateLimitingFailedError(max_retries, response)#

When rate limiting has failed more than HTTPClient.max_retries times

Hint

This can be due to a un-syncronized clock.

You can change HTTPClient.trust_local_time to False to disable using your local clock, or you could sync your clock.

You can check if your clock is synchronized by running the following command:

timedatectl

If it is synchronized, it will show “System clock synchronized: yes” and “NTP service: running”

If the system clock is not synchronized but the ntp service is running you will have to wait a few minutes for it to sync.

To enable the ntp service run the following command:

sudo timedatectl set-ntp on

This will automatically sync the system clock every once in a while.

You can check if your clock is synchronized by running the following command:

timedatectl

If it is synchronized, it will show “System clock synchronized: yes” and “NTP service: running”

If the system clock is not synchronized but the ntp service is running you will have to wait a few minutes for it to sync.

To enable the ntp service run the following command:

sudo timedatectl set-ntp on

This will automatically sync the system clock every once in a while.

This can be turned on by going to Settings -> Time & language -> Date & time and turning on Set time automatically.

Parameters
  • max_retries (int) – How many retries the request used that failed.

  • response (ClientResponse) – The response to the last request that failed.

Return type

None

max_retries#

How many retries the request used that failed.

response#

The response to the last request that failed.

exception nextcore.http.CloudflareBanError#

A error for when you get banned by cloudflare

This happens due to getting too many 401, 403 or 429 responses from discord. This will block your access to the API temporarily for an hour.

See the documentation for more info.

exception nextcore.http.HTTPRequestStatusError(error, response)#

A base error for receiving a status code the library doesn’t expect.

Parameters
  • error (HTTPErrorResponseData) – The error json from the body.

  • response (ClientResponse) – The response to the request.

Return type

None

response#

The response to the request.

error_code#

The error code.

message#

The error message.

error#

The error json from the body.

exception nextcore.http.BadRequestError(error, response)#

A 400 error.

Parameters
  • error (HTTPErrorResponseData) –

  • response (ClientResponse) –

Return type

None

exception nextcore.http.NotFoundError(error, response)#

A 404 error.

Parameters
  • error (HTTPErrorResponseData) –

  • response (ClientResponse) –

Return type

None

exception nextcore.http.UnauthorizedError(error, response)#

A 401 error.

Parameters
  • error (HTTPErrorResponseData) –

  • response (ClientResponse) –

Return type

None

exception nextcore.http.ForbiddenError(error, response)#

A 403 error.

Parameters
  • error (HTTPErrorResponseData) –

  • response (ClientResponse) –

Return type

None

exception nextcore.http.InternalServerError(error, response)#

A 5xx error.

Parameters
  • error (HTTPErrorResponseData) –

  • response (ClientResponse) –

Return type

None