Guild
Represents a Discord guild. This is referred to as a “server” in the official Discord UI.Attributes
The guild’s ID.
The guild name.
The guild owner’s ID. Use
Guild.owner instead.Returns the guild’s icon asset, if available.
Returns the guild’s banner asset, if available.
The guild’s description.
Returns the true member count regardless of it being loaded fully or not.
A list of members that belong to this guild.
Returns a list of the guild’s roles in hierarchy order. The first element of this list will be the lowest role in the hierarchy.
All emojis that the guild owns.
All stickers that the guild owns.
A list of channels that belong to this guild.
A list of threads that you have permission to view.
A list of voice channels that belong to this guild. This is sorted by the position and are in UI order from top to bottom.
A list of text channels that belong to this guild. This is sorted by the position and are in UI order from top to bottom.
A list of categories that belong to this guild. This is sorted by the position and are in UI order from top to bottom.
Similar to
Client.user except an instance of Member. This is essentially used to get the member version of yourself.The member that owns the guild.
The guild’s verification level.
The guild’s explicit content filter.
The guild’s notification settings.
A list of features that the guild has. The features that a guild can have are subject to arbitrary change by Discord.
The premium tier for this guild. Corresponds to “Nitro Server” in the official UI. The number goes from 0 to 3 inclusive.
The number of “boosts” this guild currently has.
Methods
get_member(user_id)
get_member(user_id)
Returns a member with the given ID.Returns:
The ID to search for.
Member | None - The member or None if not found.Example:get_channel(channel_id)
get_channel(channel_id)
Returns a channel with the given ID.Returns:
This does not search for threads.
The ID to search for.
GuildChannel | None - The returned channel or None if not found.Example:get_thread(thread_id)
get_thread(thread_id)
Returns a thread with the given ID.Returns:
The ID to search for.
Thread | None - The returned thread or None if not found.get_role(role_id)
get_role(role_id)
Returns a role with the given ID.Returns:
The ID to search for.
Role | None - The role or None if not found.Example:get_member_named(name)
get_member_named(name)
Returns the first member found that matches the name provided.The name can have an optional discriminator argument, e.g. “Jake#0001” or “Jake” will both do the lookup. However, the former will give a more precise result.Returns:
The name of the member to lookup with an optional discriminator.
Member | None - The member in this guild with the associated name, or None if not found.Example:async fetch_member(user_id)
async fetch_member(user_id)
Retrieves a Returns:
Member from the guild with the given ID.The ID of the member to fetch.
Member - The member from the guild.Raises: NotFound if the member is not found.Example:async create_text_channel(name, **options)
async create_text_channel(name, **options)
Creates a Returns:
TextChannel for the guild.You need the
manage_channels permission to create the channel.The channel name.
The category to place the newly created channel under.
The position in the channel list.
The channel’s topic.
Specifies the slowmode rate limit for users in this channel, in seconds.
Whether to mark the channel as NSFW.
The reason for creating this channel. Shows up on the audit log.
TextChannel - The channel that was just created.Example:async create_voice_channel(name, **options)
async create_voice_channel(name, **options)
Creates a Returns:
VoiceChannel for the guild.You need the
manage_channels permission to create the channel.The channel name.
The category to place the newly created channel under.
The position in the channel list.
The channel’s preferred audio bitrate in bits per second.
The channel’s limit for number of members that can be in a voice channel.
The reason for creating this channel. Shows up on the audit log.
VoiceChannel - The channel that was just created.async create_role(name, **options)
async create_role(name, **options)
Creates a Returns:
Role for the guild.You must have the
manage_roles permission to do this.The role name. Defaults to “new role”.
The permissions to assign to the role.
The colour for the role. (aliased to color as well)
Whether the role should be shown separately in the member list.
Whether the role should be mentionable by others.
The reason for creating this role. Shows up on the audit log.
Role - The newly created role.Example:async fetch_roles_member_counts()
async fetch_roles_member_counts()
Fetches a mapping of role IDs to their member counts for this guild.Returns:
GuildRoleCounts - A mapping of role IDs to their member counts.Example:async ban(user, **options)
async ban(user, **options)
Bans a user from the guild.Example:
You must have the
ban_members permission to do this.The user to ban from the guild.
The reason for banning this user. Shows up on the audit log.
The number of days worth of messages to delete from the user in the guild. The minimum is 0 and the maximum is 7.
async unban(user, reason=None)
async unban(user, reason=None)
