Guild

class discord_limits.paths.GuildPaths(client)
Parameters:

client (discord_limits.DiscordClient) – The DiscordClient instance to use.

async create_guild(name, verification_level=None, default_message_notifications=None, explicit_content_filter=None, roles=None, channels=None, afk_channel_id=None, afk_timeout=None, system_channel_id=None, system_channel_flags=None)

Create a new guild.

Parameters:
  • name (str) – Name of the guild (2-100 characters).

  • verification_level (int, optional) – The verification level for the guild, by default None

  • default_message_notifications (int, optional) – The default message notification level, by default None

  • explicit_content_filter (int, optional) – The explicit content filter level, by default None

  • roles (List[Any], optional) – The roles for the guild, by default None

  • channels (List[Any], optional) – The channels for the guild, by default None

  • afk_channel_id (int, optional) – The ID for afk channel, by default None

  • afk_timeout (int, optional) – The AFK timeout in seconds, by default None

  • system_channel_id (int, optional) – The id of the channel where guild notices are sent, by default None

  • system_channel_flags (int, optional) – System channel flags, by default None

Returns:

A guild object.

Return type:

ClientResponse

async get_guild(guild_id, with_counts=True)

Get a guild by ID.

Parameters:
  • guild_id (int) – The ID of the guild to get.

  • with_counts (bool, optional) – When true, will return approximate member and presence counts for the guild, by default True

Returns:

A guild object.

Return type:

ClientResponse

async get_guild_preview(guild_id)

Get a guild preview by ID.

Parameters:

guild_id (int) – The ID of the guild to get.

Returns:

A guild preview object.

Return type:

ClientResponse

async edit_guild(guild_id, reason=None, **options)

Edit a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

  • options (Any) – The params required to update the required aspects of the guild.

Returns:

A guild object.

Return type:

ClientResponse

async delete_guild(guild_id)

Delete a guild.

Parameters:

guild_id (int) – The ID of the guild to delete.

Returns:

The response from Discord.

Return type:

ClientResponse

async get_guild_channels(guild_id)

Get a guild’s channels.

Parameters:

guild_id (int) – The ID of the guild to get channels for.

Returns:

A list of guild channel objects.

Return type:

ClientResponse

async create_channel(guild_id, name, *, reason=None, **options)

Create a channel in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to create a channel in.

  • name (str) – The channel name (1-100 characters).

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

  • options (Any) – The params required to create a channel of the required settings.

Returns:

A channel object.

Return type:

ClientResponse

async edit_channel_position(guild_id, channel_id, position, sync_permissions, parent_id, reason=None)

Edit a channel’s position in the channel list.

Parameters:
  • guild_id (int) – The ID of the guild to edit the channel position in.

  • channel_id (int) – The ID of the channel to edit.

  • position (int) – The new position of the channel.

  • sync_permissions (bool) – Whether to sync permissions with the channel’s new position.

  • parent_id (int) – The ID of the new parent category for the channel.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_active_threads(guild_id)

Get a guild’s active threads.

Parameters:

guild_id (int) – The ID of the guild to get active threads for.

Returns:

A list of threads and members.

Return type:

ClientResponse

async get_member(guild_id, member_id)

Get a member in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to get a member from.

  • member_id (int) – The ID of the member to get.

Returns:

A guild member object.

Return type:

ClientResponse

async get_members(guild_id, limit=1, after=None)

Get a list of members in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to get members from.

  • limit (int, optional) – Max number of members to return (1-1000), by default 1

  • after (int, optional) – The highest user id in the previous page, by default None

Returns:

A list of guild member objects.

Return type:

ClientResponse

Raises:

InvalidParams – If the limit is not between 1 and 1000.

async search_guild_members(guild_id, query, limit=1)

Search for members in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to search for members in.

  • query (str) – The query to search for.

  • limit (int, optional) – Max number of members to return (1-1000), by default 1

Returns:

A list of guild member objects.

Return type:

ClientResponse

Raises:

InvalidParams – If the limit is not between 1 and 1000.

async add_guild_member(guild_id, user_id, access_token, nick=None, roles=None, mute=False, deaf=False)

Add a member to a guild.

Parameters:
  • guild_id (int) – The ID of the guild to add a member to.

  • user_id (int) – The ID of the user to add.

  • access_token (str) – The access token of the user to add.

  • nick (str, optional) – Value to set user’s nickname to, by default None

  • roles (List[int], optional) – Array of role ids the member is assigned, by default None

  • mute (bool, optional) – Whether the user is muted in voice channels, by default False

  • deaf (bool, optional) – Whether the user is deafened in voice channels, by default False

Returns:

The response from Discord.

Return type:

ClientResponse

async modify_guild_member(user_id, guild_id, nick=None, roles=None, mute=None, deafen=None, channel_id=None, timeout=None, reason=None)

Modify a member in a guild.

Parameters:
  • user_id (int) – The ID of the user to modify.

  • guild_id (int) – The ID of the guild to modify the member in.

  • nick (str, optional) – Value to set user’s nickname to, by default None

  • roles (List[int], optional) – Array of role ids the member is assigned, by default None

  • mute (bool, optional) – Whether the user is muted in voice channels, by default None

  • deafen (bool, optional) – Whether the user is deafened in voice channels, by default None

  • channel_id (int, optional) – ID of channel to move user to, by default None

  • timeout (ISO8601_timestamp, optional) – When the user’s timeout will expire and the user will be able to communicate in the guild again, by default None

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async modify_current_member(guild_id, nick, reason=None)

Modify the current user in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to modify the member in.

  • nick (str) – Value to set user’s nickname to.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async add_role(guild_id, user_id, role_id, reason=None)

Add a role to a member in a guild.

Parameters:
  • guild_id (int) – The ID of the guild that the users is in.

  • user_id (int) – The ID of the user to add a role to.

  • role_id (int) – The ID of the role to add.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async remove_role(guild_id, user_id, role_id, reason=None)

Remove a role from a member in a guild.

Parameters:
  • guild_id (int) – The ID of the guild that the users is in.

  • user_id (int) – The ID of the user to remove a role from.

  • role_id (int) – The ID of the role to remove.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async kick(user_id, guild_id, reason=None)

Kick a member from a guild.

Parameters:
  • user_id (int) – The ID of the user to kick.

  • guild_id (int) – The ID of the guild to kick the member from.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_bans(guild_id, limit=1000, before=None, after=None)

Get a list of all bans in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to get bans from.

  • limit (int, optional) – The number of users to return (up to maximum 1000), by default 1000

  • before (int, optional) – Consider only users before given user id, by default None

  • after (int, optional) – Consider only users after given user id, by default None

Returns:

A list of ban objects.

Return type:

ClientResponse

async get_ban(user_id, guild_id)

Get a ban from a guild.

Parameters:
  • user_id (int) – The ID of the user to get a ban from.

  • guild_id (int) – The ID of the guild to get a ban from.

Returns:

A ban object.

Return type:

ClientResponse

async ban(user_id, guild_id, delete_message_days=0, reason=None)

Ban a user from a guild.

Parameters:
  • user_id (int) – The ID of the user to ban.

  • guild_id (int) – The ID of the guild to ban the user from.

  • delete_message_days (int, optional) – Number of days to delete messages for (0-7), by default 0

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

A ban object.

Return type:

ClientResponse

Raises:

InvalidParams – If the delete_message_days is not an integer between 0 and 7.

async unban(user_id, guild_id, *, reason=None)

Unban a user from a guild.

Parameters:
  • user_id (int) – The ID of the user to unban.

  • guild_id (int) – The ID of the guild to unban the user from.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_roles(guild_id)

Get a list of all roles in a guild.

Parameters:

guild_id (int) – The ID of the guild to get roles from.

Returns:

A list of role objects.

Return type:

ClientResponse

async create_role(guild_id, name=None, permissions=None, colour=None, hoist=None, unicode_emoji=None, mentionable=None, reason=None)

Create a role in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to create a role in.

  • name (str, optional) – Name of the role, by default None

  • permissions (str, optional) – Bitwise value of the enabled permissions, by default None

  • colour (int, optional) – RGB colour value, by default None

  • hoist (bool, optional) – Whether the role should be displayed separately in the sidebar, by default None

  • unicode_emoji (str, optional) – The role’s unicode emoji as a standard emoji, by default None

  • mentionable (bool, optional) – Whether the role should be mentionable, by default None

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

A role object.

Return type:

ClientResponse

async move_role_position(guild_id, role_id, position, reason=None)

Move a role’s position in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to move a role in.

  • role_id (int) – The ID of the role to move.

  • position (int) – The new position of the role.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

A list of role objects.

Return type:

ClientResponse

async edit_role(guild_id, role_id, reason=None, **fields)

Edit a role in a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit a role in.

  • role_id (int) – The ID of the role to edit.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

  • **fields (Any) – The params required to update the required aspects of the role.

Returns:

A role object.

Return type:

ClientResponse

async delete_role(guild_id, role_id, reason=None)

Delete a role from a guild.

Parameters:
  • guild_id (int) – The ID of the guild to delete a role from.

  • role_id (int) – The ID of the role to delete.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async estimate_pruned_members(guild_id, days=7, roles=None)

Get the number of members that would be removed from a guild if prune was run.

Parameters:
  • guild_id (int) – The ID of the guild to get prune estimates for.

  • days (int, optional) – Number of days to count prune for (1-30), by default 7

  • roles (str, optional) – Role(s) to include, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

Raises:

InvalidParams – If the days parameter is not between 1 and 30.

async prune_members(guild_id, days=7, compute_prune_count=False, roles=None, reason=None)

Prune members from a guild.

Parameters:
  • guild_id (int) – The ID of the guild to prune members from.

  • days (int, optional) – Number of days to prune (1-30), by default 7

  • compute_prune_count (bool, optional) – Whether pruned is returned, by default False

  • roles (List[int], optional) – Role(s) to include, by default None

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

Raises:

InvalidParams – If the days parameter is not between 1 and 30.

async get_voice_regions(guild_id)

Get the voice regions for a guild.

Parameters:

guild_id (int) – The ID of the guild to get voice regions for.

Returns:

A list of voice region objects.

Return type:

ClientResponse

async get_guild_invites(guild_id)

Get the invites for a guild.

Parameters:

guild_id (int) – The ID of the guild to get invites for.

Returns:

A list of invite objects.

Return type:

ClientResponse

async get_guild_integrations(guild_id)

Get the integrations for a guild.

Parameters:

guild_id (int) – The ID of the guild to get integrations for.

Returns:

A list of integration objects.

Return type:

ClientResponse

async create_integration(guild_id, type, id)

Create an integration for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to create an integration for.

  • type (Any) – The type of integration to create.

  • id (Any) – The ID of the integration to create.

Returns:

The response from Discord.

Return type:

ClientResponse

async edit_integration(guild_id, integration_id, **payload)

Edit an integration for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit an integration for.

  • integration_id (int) – The ID of the integration to edit.

  • payload (Any) – The params for the JSON payload.

Returns:

The response from Discord.

Return type:

ClientResponse

async sync_integration(guild_id, integration_id)

Sync an integration for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to sync an integration for.

  • integration_id (int) – The ID of the integration to sync.

Returns:

The response from Discord.

Return type:

ClientResponse

async delete_guild_integration(guild_id, integration_id, *, reason=None)

Delete an integration for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to delete an integration for.

  • integration_id (int) – The ID of the integration to delete.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_guild_widget_settings(guild_id)

Get the widget settings for a guild.

Parameters:

guild_id (int) – The ID of the guild to get widget settings for.

Returns:

A guild widget settings object.

Return type:

ClientResponse

async edit_widget(guild_id, enabled, channel_id, reason=None)

Edit the widget settings for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit widget settings for.

  • enabled (_type_) – Whether the widget is enabled.

  • channel_id (int) – The ID of the channel to send the widget to.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

A guild widget settings object.

Return type:

ClientResponse

async get_guild_widget(guild_id)

Get the widget for a guild.

Parameters:

guild_id (int) – The ID of the guild to get widget for.

Returns:

A guild widget object.

Return type:

ClientResponse

async get_vanity_code(guild_id)

Get the vanity URL for a guild.

Parameters:

guild_id (int) – The ID of the guild to get the vanity URL for.

Returns:

A partial invite object.

Return type:

ClientResponse

async change_vanity_code(guild_id, code, reason=None)

Change the vanity URL for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to change the vanity URL for.

  • code (_type_) – The vanity URL code.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_guild_welcome_screen(guild_id)

Get the welcome screen for a guild.

Parameters:

guild_id (int) – The ID of the guild to get the welcome screen for.

Returns:

A welcome screen object.

Return type:

ClientResponse

async edit_guild_welcome_screen(guild_id, enabled=None, welcome_channels=None, description=None, reason=None)

Edit the welcome screen for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit the welcome screen for.

  • enabled (bool, optional) – Whether the welcome screen is enabled, by default None

  • welcome_channels (List[Any], optional) – Channels linked in the welcome screen and their display options, by default None

  • description (str, optional) – The server description to show in the welcome screen, by default None

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

A welcome screen object.

Return type:

ClientResponse

async edit_voice_state(guild_id, channel_id, suppress=None, request_to_speak_timestamp=None)

Edit the voice state for a user.

Parameters:
  • guild_id (int) – The ID of the guild to edit the voice state for.

  • channel_id (int) – The id of the channel the user is currently in.

  • suppress (bool, optional) – Toggles the user’s suppress state, by default None

  • request_to_speak_timestamp (ISO8601_timestamp, optional) – Sets the user’s request to speak, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async edit_users_voice_state(guild_id, user_id, channel_id, suppress=None)

Edit the voice state for a user.

Parameters:
  • guild_id (int) – The ID of the guild to edit the voice state for.

  • user_id (int) – The ID of the user to edit the voice state for.

  • channel_id (int) – The id of the channel the user is currently in

  • suppress (bool, optional) – Toggles the user’s suppress state, by default None

Returns:

_description_

Return type:

ClientResponse

async get_scheduled_events(guild_id, with_user_count)

Get the scheduled events for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to get the scheduled events for.

  • with_user_count (bool) – Include number of users subscribed to each event.

Returns:

A list of guild scheduled event objects.

Return type:

ClientResponse

async create_guild_scheduled_event(guild_id, reason=None, **payload)

Create a scheduled event for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to create the scheduled event for.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

  • payload (Any) – The params for the JSON payload.

Returns:

A guild scheduled event object.

Return type:

ClientResponse

async get_scheduled_event(guild_id, guild_scheduled_event_id, with_user_count)

Get a scheduled event for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to get the scheduled event for.

  • guild_scheduled_event_id (int) – The ID of the scheduled event to get.

  • with_user_count (bool) – Include number of users subscribed to this event.

Returns:

A guild scheduled event object.

Return type:

ClientResponse

async edit_scheduled_event(guild_id, guild_scheduled_event_id, *, reason=None, **payload)

Edit a scheduled event for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit the scheduled event for.

  • guild_scheduled_event_id (int) – The ID of the scheduled event to edit.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

  • payload (Any) – The params required to update the required aspects of the scheduled event.

Returns:

A guild scheduled event object.

Return type:

ClientResponse

async delete_scheduled_event(guild_id, guild_scheduled_event_id, reason=None)

Delete a scheduled event for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to delete the scheduled event for.

  • guild_scheduled_event_id (int) – The ID of the scheduled event to delete.

  • reason (str, optional) – A reason for this action that will be displayed in the audit log, by default None

Returns:

The response from Discord.

Return type:

ClientResponse

async get_scheduled_event_users(guild_id, guild_scheduled_event_id, limit, with_member, before=None, after=None)

Get the users subscribed to a scheduled event.

Parameters:
  • guild_id (int) – The ID of the guild to get the scheduled event users for.

  • guild_scheduled_event_id (int) – The ID of the scheduled event to get the users for.

  • limit (int) – Number of users to return (up to maximum 100)

  • with_member (bool) – Include guild member data if it exists

  • before (int, optional) – Consider only users before given user id, by default None

  • after (int, optional) – Consider only users after given user id, by default None

Returns:

A list of guild scheduled event user objects.

Return type:

ClientResponse

async get_template(code)

Get a guild template.

Parameters:

code (str) – The code of the template to get.

Returns:

A guild template object.

Return type:

ClientResponse

async create_from_template(code, name)

Create a guild from a template.

Parameters:
  • code (str) – The code of the template to create the guild from.

  • name (str) – Name of the guild (2-100 characters).

Returns:

A guild object.

Return type:

ClientResponse

async get_guild_templates(guild_id)

Get a guild’s templates.

Parameters:

guild_id (int) – The ID of the guild to get the templates for.

Returns:

A list of guild template objects.

Return type:

ClientResponse

async create_template(guild_id, name, description=None)

Create a template for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to create the template for.

  • name (str) – Name of the template (1-100 characters).

  • description (str, optional) – Description for the template (0-120 characters), by default None

Returns:

A guild template object.

Return type:

ClientResponse

async sync_template(guild_id, code)

Sync a template for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to sync the template for.

  • code (str) – The code of the template to sync.

Returns:

A guild template object.

Return type:

ClientResponse

async edit_template(guild_id, code, name, description=None)

Edit a template for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to edit the template for.

  • code (str) – The code of the template to edit.

  • name (str) – Name of the template (1-100 characters)

  • description (str, optional) – Description for the template (0-120 characters), by default None

Returns:

A guild template object.

Return type:

ClientResponse

async delete_template(guild_id, code)

Delete a template for a guild.

Parameters:
  • guild_id (int) – The ID of the guild to delete the template for.

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

Returns:

A guild template object.

Return type:

ClientResponse