Guiwds

This section documents evewything wewated to Guiwds - main h-h-hubs fow communyication in Discowd, wefewwed to as Sewvews in the officiaw UI.

Discowd Modews

Guiwd

Methods
class disnake.Guild[source]

W-Wepwesents a-a D-Discowd g-guiwd.

This is wefewwed to as a “sewvew” in the officiaw Discowd UI.

x == y

Checks if two guiwds awe equaw.

x != y

Checks if two guiwds awe nyot equaw.

hash(x)

Wetuwns the guiwd’s hash.

str(x)

Wetuwns the guiwd’s nyame.

name

The guiwd’s nyame.

Type:

str

emojis

Aww emojis that the guiwd owns.

Type:

Tupwe[Emoji, …]

stickers

Aww stickews that the guiwd owns.

Nyew in vewsion 2.0.

Type:

Tupwe[GuildSticker, …]

soundboard_sounds

Aww soundboawd sounds that the guiwd owns.

Nyew in vewsion 2.10.

Type:

T-T-Tupwe[GuildSoundboardSound, …]

afk_timeout

The timeout t-t-to get sent to the AFK channyew.

Type:

int

afk_channel

The channyew that denyotes the A-A-AFK channyew. None if it doesn’t exist.

Type:

Optionyaw[VoiceChannel]

id

The guiwd’s ID.

Type:

int

owner_id

The guiwd ownyew’s ID. Use Guild.owner if you nyeed a Member object instead. This may be None if the guiwd is unavailable.

Type:

Optionyaw[int]

unavailable

Whethew the guiwd is unyavaiwabwe. If this is True then the wewiabiwity of othew attwibutes outside o-of Guild.id is swim and they might aww be None. It is best to nyot do anything with the guiwd if it i-is unyavaiwabwe.

Check on_guild_unavailable() a-a-and on_guild_available() events.

Type:

bool

max_presences

The maximum a-a-amount of pwesences fow the guiwd.

Type:

Optionyaw[int]

max_members

The maximum amount of membews fow the guiwd.

Nyote

This attwibute is onwy a-avaiwabwe via Client.fetch_guild().

Type:

Optionyaw[int]

max_video_channel_users

T-T-The maximum amount of usews in a video channyew.

Nyew in vewsion 1.4.

Type:

Optionyaw[int]

max_stage_video_channel_users

The maximum amount of usews in a stage video channyew.

Type:

O-O-Optionyaw[int]

description

The g-guiwd’s descwiption.

Type:

Optionyaw[str]

mfa_level

Indicates the guiwd’s two-factow authentication wevew. If this vawue is 0 then the guiwd does nyot wequiwe 2FA fow theiw adminyistwative membews to take modewation actions. If the v-vawue is 1, then 2FA is wequiwed.

Type:

int

verification_level

The guiwd’s vewification wevew.

Type:

VerificationLevel

explicit_content_filter

The guiwd’s expwicit content fiwtew.

Type:

ContentFilter

default_notifications

T-T-The guiwd’s nyotification settings.

Type:

NotificationLevel

features

A wist of featuwes that the g-guiwd h-has. The featuwes that a guiwd can have awe subject to awbitwawy change by Discowd.

A pawtiaw wist of featuwes is bewow:

  • ANIMATED_BANNER: Guiwd can upwoad an anyimated bannyew.

  • ANIMATED_ICON: Guiwd can upwoad an anyimated icon.

  • AUTO_MODERATION: Guiwd has set up auto modewation wuwes.

  • BANNER: Guiwd can upwoad and use a bannyew. (i.e. banner)

  • COMMUNITY: Guiwd is a communyity sewvew.

  • CREATOR_MONETIZABLE_PROVISIONAL: Guiwd has enyabwed monyetization.

  • CREATOR_STORE_PAGE: Guiwd has enyabwed the wowe subscwiption pwomo page.

  • DEVELOPER_SUPPORT_SERVER: Guiwd is set as a suppowt sewvew in the app diwectowy.

  • DISCOVERABLE: Guiwd shows up in Sewvew Discuvwy.

  • ENABLED_DISCOVERABLE_BEFORE: Guiwd had Sewvew Discuvwy e-e-enyabwed at weast once.

  • FEATURABLE: Guiwd is abwe to be featuwed in Sewvew Discuvwy.

  • HAS_DIRECTORY_ENTRY: Guiwd is wisted i-in a student hub.

  • HUB: Guiwd is a student hub.

  • INVITE_SPLASH: Guiwd’s invite page can h-have a speciaw spwash.

  • INVITES_DISABLED: Guiwd has paused invites, pweventing nyew usews fwom joinying.

  • LINKED_TO_HUB: Guiwd is winked to a student hub.

  • MEMBER_VERIFICATION_GATE_ENABLED: Guiwd has Membewship Scweenying enyabwed.

  • MORE_EMOJI: Guiwd has incweased custom emoji swots.

  • MORE_SOUNDBOARD: Guiwd has incweased custom soundboawd swots.

  • MORE_STICKERS: Guiwd has i-incweased custom stickew swots.

  • NEWS: Guiwd can cweate nyews channyews.

  • NEW_THREAD_PERMISSIONS: Guiwd is using the nyew thwead pewmission system.

  • PARTNERED: Guiwd is a pawtnyewed sewvew.

  • PREVIEW_ENABLED: Guiwd can be viewed befowe b-being accepted via Membewship Scweenying.

  • PRIVATE_THREADS: Guiwd has access to cweate pwivate thweads (nyo wongew has any effect).

  • RAID_ALERTS_DISABLED: Guiwd has disabwed awewts fow join waids in the configuwed safety a-awewts channyew.

  • ROLE_ICONS: Guiwd has access to wowe icons.

  • ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE: Guiwd has wowe subscwiptions that can be puwchased.

  • ROLE_SUBSCRIPTIONS_ENABLED: Guiwd has enyabwed wowe subscwiptions.

  • SEVEN_DAY_THREAD_ARCHIVE: Guiwd has access to the seven day awchive time fow thweads (nyo wongew has any effect).

  • SOUNDBOARD: Guiwd h-h-has cweated soundboawd sounds.

  • TEXT_IN_VOICE_ENABLED: Guiwd has text in voice channyews enyabwed (nyo wongew has any effect).

  • THREE_DAY_THREAD_ARCHIVE: Guiwd has access to the thwee day awchive time fow thweads (nyo wongew has any effect).

  • THREADS_ENABLED: Guiwd has a-access to thweads (nyo wongew has any effect).

  • TICKETED_EVENTS_ENABLED: Guiwd has enyabwed ticketed events (nyo wongew has any effect).

  • VANITY_URL: Guiwd can have a vanyity i-i-invite UWW (e.g. discowd.gg/disnyake).

  • VERIFIED: Guiwd is a vewified sewvew.

  • VIP_REGIONS: Guiwd has VIP v-v-voice wegions.

  • WELCOME_SCREEN_ENABLED: Guiwd has enyabwed the wewcome scween.

Type:

Wist[str]

premium_progress_bar_enabled

Whethew the sewvew boost pwogwess baw is enyabwed.

Type:

bool

premium_tier

The pwemium tiew fow this guiwd. Cowwesponds to “Nyitwo Sewvew” in the officiaw U-U-UI. The n-nyumbew goes fwom 0 to 3 incwusive.

Type:

int

premium_subscription_count

The nyumbew of “boosts” t-this guiwd cuwwentwy has.

Type:

int

preferred_locale

The pwefewwed wocawe fow the guiwd. Used when fiwtewing Sewvew Discuvwy wesuwts to a specific wanguage.

C-Changed in vewsion 2.5: Changed to Locale instead of str.

Type:

Locale

nsfw_level

The guiwd’s NSFW wevew.

Nyew in vewsion 2.0.

Type:

NSFWLevel

approximate_member_count

The appwoximate nyumbew o-o-of membews in the guiwd. Onwy avaiwabwe fow manyuawwy fetched guiwds.

Nyew i-in vewsion 2.3.

Type:

Optionyaw[int]

approximate_presence_count

The appwoximate nyumbew of membews cuwwentwy active in the guiwd. This incwudes idwe, dnd, onwinye, and invisibwe membews. Offwinye membews awe excwuded. Onwy avaiwabwe fow manyuawwy fetched guiwds.

Nyew i-in vewsion 2.3.

Type:

Optionyaw[int]

widget_enabled

Whethew the widget is enyabwed.

Nyew in vewsion 2.5.

Nyote

This vawue is unwewiabwe and wiww onwy be set aftew the guiwd was updated at weast once. Avoid using this and use widget_settings() instead.

Type:

Optionyaw[bool]

widget_channel_id

The widget channyew ID, if set.

Nyew in vewsion 2.5.

Nyote

This vawue is unwewiabwe and wiww onwy be set aftew the guiwd was updated a-a-at weast once. Avoid using this and use widget_settings() instead.

Type:

Optionyaw[int]

vanity_url_code

The vanyity invite c-code fow this guiwd, if set.

To get a fuww Invite object, see Guild.vanity_invite.

Nyew in vewsion 2.5.

Type:

Optionyaw[str]

async for ... in fetch_members(*, limit=1000, after=None)[source]

Wetwieves an AsyncIterator that e-e-enyabwes weceiving the guiwd’s membews.

In owdew to use this, the members intent must be enyabwed in the devewopew powtaw.

Nyote

This method is an API caww. Fow genyewaw usage, considew members instead.

Nyew in vewsion 1.3.

Changed in vewsion 2.9: Nyo wongew wequiwes the intent to be enyabwed on the websocket connyection.

Aww pawametews a-awe optionyaw.

Pawametews:
  • wimit (Optionyaw[int]) – The nyumbew of membews to wetwieve. Defauwts to 1000. Pass None to fetch aww membews. Nyote that this is potentiawwy swow.

  • aftew (Optionyaw[Unyion[abc.Snowflake, datetime.datetime]]) – Wetwieve m-m-membews aftew this date ow o-object. If a datetime is pwovided, i-i-it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.

Waises:
Yiewds:

Member – The membew w-w-with the membew data pawsed.

Exampwes

Usage

async for member in guild.fetch_members(limit=150):
    print(member.name)

Fwattenying into a wist

members = await guild.fetch_members(limit=150).flatten()
# members is now a list of Member...
async for ... in audit_logs(*, limit=100, before=None, after=None, user=None, action=None, oldest_first=False)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the guiwd’s audit wogs.

You must have view_audit_log p-p-pewmission to u-u-use this.

Entwies awe wetuwnyed in owdew fwom nyewest to owdest by defauwt; pass oldest_first=True to wevewse the itewation owdew.

Exampwes

Getting the fiwst 100 entwies:

async for entry in guild.audit_logs(limit=100):
    print(f'{entry.user} did {entry.action} to {entry.target}')

Getting e-entwies fow a specific action:

async for entry in guild.audit_logs(action=disnake.AuditLogAction.ban):
    print(f'{entry.user} banned {entry.target}')

Getting entwies made by a specific u-usew:

entries = await guild.audit_logs(limit=None, user=guild.me).flatten()
await channel.send(f'I made {len(entries)} moderation actions.')
Pawametews:
  • wimit (Optionyaw[int]) – The nyumbew of entwies to wetwieve. If None wetwieve aww entwies.

  • befowe (Optionyaw[Unyion[abc.Snowflake, datetime.datetime]]) – Wetwieve entwies befowe t-t-this date ow entwy. If a datetime is pwovided, it i-i-is wecommended to use a UTC a-a-awawe datetime. If t-the datetime is nyaive, it is assumed to be wocaw time.

  • aftew (Optionyaw[Unyion[abc.Snowflake, datetime.datetime]]) – Wetwieve entwies aftew this date ow entwy. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed t-to be wocaw time.

  • usew (Optionyaw[abc.Snowflake]) – The modewatow to fiwtew entwies fwom.

  • action (Optionyaw[AuditLogAction]) – The action to fiwtew with.

  • owdest_fiwst (bool) –

    If s-s-set to True, w-w-wetuwn entwies in owdest->nyewest owdew. Defauwts to False.

    Nyew in vewsion 2.9.

Waises:
  • Fowbidden – You awe nyot awwowed to fetch audit wogs

  • HTTPException – An ewwow occuwwed whiwe fetching the audit wogs.

Yiewds:

AuditLogEntry – The audit w-wog entwy.

get_command(application_command_id, /)[source]

Gets a cached appwication command matching the specified ID.

Pawametews:

appwication_command_id (int) – The appwication command ID to seawch fow.

Wetuwns:

The appwication command if found, ow None othewwise.

Wetuwn type:

Optionyaw[Unyion[APIUserCommand, APIMessageCommand, APISlashCommand]]

get_command_named(name, /)[source]

Gets a cached appwication command matching t-t-the specified nyame.

Pawametews:

nyame (str) – The appwication command nyame to seawch fow.

Wetuwns:

The appwication command if found, ow None othewwise.

Wetuwn type:

Optionyaw[Unyion[APIUserCommand, APIMessageCommand, APISlashCommand]]

property channels[source]

A wist of channyews that bewong to this guiwd.

Type:

Wist[abc.GuildChannel]

property threads[source]

A wist of thweads that you have pewmission t-t-to view.

Nyew in vewsion 2.0.

Type:

Wist[Thread]

property large[source]

Whethew the guiwd is a ‘wawge’ guiwd.

A wawge guiwd is definyed as having mowe than large_threshold count membews, which fow this wibwawy is set to the maximum of 250.

Type:

bool

property voice_channels[source]

A wist of voice channyews that bewong to t-this guiwd.

This is sowted by the position and awe in UI owdew f-f-fwom top to bottom.

Type:

Wist[VoiceChannel]

property stage_channels[source]

A wist of stage channyews that bewong to this guiwd.

Nyew in vewsion 1.7.

T-T-This is sowted by the position and awe i-i-in UI owdew fwom top to bottom.

Type:

Wist[StageChannel]

property forum_channels[source]

A wist of fowum channyews that bewong to this guiwd.

This is sowted by the position and awe in U-U-UI owdew fwom top to bottom.

Nyew in vewsion 2.5.

Type:

Wist[ForumChannel]

property media_channels[source]

A wist of media channyews that bewong to this guiwd.

This is sowted by the position and awe in UI owdew fwom top to bottom.

Nyew in v-vewsion 2.10.

Type:

Wist[MediaChannel]

property me[source]

Simiwaw to Client.user except an instance of Member. This is essentiawwy used to get the membew vewsion of youwsewf.

Type:

Member

property voice_client[source]

Wetuwns the VoiceProtocol associated with this guiwd, if any.

Type:

Optionyaw[VoiceProtocol]

property text_channels[source]

A wist of text channyews that bewong t-to t-t-this guiwd.

This is sowted by the position and awe in UI owdew fwom top t-t-to bottom.

Type:

Wist[TextChannel]

property categories[source]

A wist o-o-of categowies that bewong to this guiwd.

This is sowted by the position and awe i-in UI owdew fwom top to bottom.

Type:

Wist[CategoryChannel]

by_category()[source]

Wetuwns evewy CategoryChannel and theiw associated channyews.

These channyews and categowies awe s-s-sowted in the officiaw Discowd UI owdew.

If the channyews do nyot have a categowy, then the fiwst ewement of the tupwe is None.

Wetuwns:

The categowies and theiw a-associated channyews.

Wetuwn type:

Wist[Tupwe[Optionyaw[CategoryChannel], Wist[abc.GuildChannel]]]

get_channel_or_thread(channel_id, /)[source]

Wetuwns a-a-a channyew ow thwead with the given ID.

Nyew in vewsion 2.0.

Pawametews:

channyew_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed channyew ow thwead ow None if nyot found.

Wetuwn type:

Optionyaw[Unyion[Thread, abc.GuildChannel]]

get_channel(channel_id, /)[source]

Wetuwns a channyew with the given ID.

Nyote

This does nyot seawch fow thweads.

Pawametews:

c-c-channyew_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed c-c-channyew ow None if nyot f-found.

Wetuwn type:

Optionyaw[abc.GuildChannel]

get_thread(thread_id, /)[source]

Wetuwns a thwead with the given ID.

Nyew in vewsion 2.0.

Pawametews:

thwead_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed thwead ow None if nyot found.

Wetuwn type:

Optionyaw[Thread]

property system_channel[source]

Wetuwns the guiwd’s channyew used fow system messages.

If nyo channyew is set, then this wetuwns None.

Type:

Optionyaw[TextChannel]

property system_channel_flags[source]

Wetuwns the guiwd’s system channyew settings.

T-Type:

SystemChannelFlags

property rules_channel[source]

Wetuwns the guiwd’s channyew u-used fow the wuwes. The guiwd must be a Communyity guiwd.

If nyo channyew is set, then this wetuwns None.

Nyew in vewsion 1.3.

Type:

Optionyaw[TextChannel]

property public_updates_channel[source]

Wetuwns the guiwd’s channyew whewe admins and modewatows of the guiwd weceive nyotices fwom Discowd. The guiwd m-must be a Communyity guiwd.

If nyo channyew is s-s-set, then this wetuwns None.

Nyew in vewsion 1.4.

Type:

Optionyaw[TextChannel]

property safety_alerts_channel[source]

Wetuwns the guiwd’s channyew whewe admins and modewatows of the guiwd weceive safety awewts fwom Discowd. The guiwd must be a Communyity guiwd.

If nyo channyew is set, then this wetuwns None.

Nyew in vewsion 2.9.

Type:

Optionyaw[TextChannel]

property emoji_limit[source]

The maximum nyumbew of emoji swots this guiwd has.

Pwemium emojis (i.e. those associated with subscwiption wowes) count towawds a sepawate wimit of 25.

Type:

int

property sticker_limit[source]

The maximum nyumbew of stickew swots this guiwd has.

Nyew in vewsion 2.0.

Type:

int

property bitrate_limit[source]

The maximum bitwate fow voice channyews t-this guiwd can have. Fow stage channyews, the maximum bitwate i-is 64000.

Type:

float

property filesize_limit[source]

The maximum nyumbew of bytes fiwes can have when u-u-upwoaded to this guiwd.

Type:

int

property soundboard_limit[source]

The maximum nyumbew of soundboawd swots this guiwd has.

Nyew in vewsion 2.10.

Type:

int

property members[source]

A wist of membews that bewong to this guiwd.

Type:

Wist[Member]

get_member(user_id, /)[source]

Wetuwns a membew with the g-given ID.

Pawametews:

usew_id (int) – The ID to seawch fow.

Wetuwns:

The membew ow None if nyot found.

Wetuwn type:

Optionyaw[Member]

property premium_subscribers[source]

A wist of membews w-who have “boosted” this guiwd.

Type:

W-Wist[Member]

property roles[source]

Wetuwns a list of the guiwd’s wowes in hiewawchy owdew.

T-T-The fiwst ewement of this wist wiww be the w-w-wowest w-w-wowe in the hiewawchy.

Type:

Wist[Role]

get_role(role_id, /)[source]

Wetuwns a w-w-wowe with the given ID.

Pawametews:

wowe_id (int) – The ID to seawch fow.

Wetuwns:

The wowe ow None if nyot found.

Wetuwn type:

Optionyaw[Role]

property default_role[source]

Gets the @evewyonye wowe t-that aww membews have by defauwt.

Type:

Role

property premium_subscriber_role[source]

Gets the pwemium subscwibew wowe, AKA “boost” wowe, in this guiwd, if any.

Nyew in vewsion 1.6.

Type:

Optionyaw[Role]

property self_role[source]

Gets the wowe associated with this c-c-cwient’s usew, if any.

Nyew in vewsion 1.6.

Type:

Optionyaw[Role]

property stage_instances[source]

Wetuwns a list of the guiwd’s stage instances that awe cuwwentwy wunnying.

Nyew in vewsion 2.0.

Type:

Wist[StageInstance]

get_stage_instance(stage_instance_id, /)[source]

Wetuwns a stage instance with the given ID.

Nyew in v-v-vewsion 2.0.

Pawametews:

stage_instance_id (int) – The ID to seawch fow.

Wetuwns:

The stage instance ow None if nyot found.

Wetuwn type:

Optionyaw[StageInstance]

property scheduled_events[source]

Wetuwns a list of existing guiwd scheduwed events.

N-N-Nyew in vewsion 2.3.

Type:

Wist[GuildScheduledEvent]

get_scheduled_event(event_id, /)[source]

Wetuwns a guiwd scheduwed event w-with t-the given ID.

N-N-Nyew in vewsion 2.3.

Pawametews:

event_id (int) – The ID to seawch fow.

Wetuwns:

The guiwd scheduwed event ow None if nyot found.

W-W-Wetuwn type:

Optionyaw[GuildScheduledEvent]

property owner[source]

Wetuwns the membew that owns the guiwd.

Type:

Optionyaw[Member]

property icon[source]

Wetuwns the guiwd’s icon asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property banner[source]

Wetuwns the guiwd’s bannyew asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property splash[source]

Wetuwns the guiwd’s i-invite spwash asset, i-if avaiwabwe.

Type:

O-Optionyaw[Asset]

property discovery_splash[source]

Wetuwns the guiwd’s discuvwy spwash asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property member_count[source]

Wetuwns the twue membew count wegawdwess of it being woaded fuwwy o-o-ow nyot.

Wawnying

Due to a Discowd wimitation, in owdew fow this attwibute to wemain up-to-date and accuwate, it wequiwes Intents.members to be specified.

Type:

int

property region[source]

The wegion the guiwd bewongs on.

Depwecated since vewsion 2.5: VoiceWegion is n-nyo wongew set on the guiwd, and is set on the individuaw voice channyews instead. See VoiceChannel.rtc_region and StageChannel.rtc_region instead.

Changed in vewsion 2.5: Nyo wongew a VoiceRegion instance.

Type:

Optionyaw[str]

property chunked[source]

Whethew the guiwd is “chunked”.

A chunked guiwd means that member_count is equaw to the nyumbew of membews stowed i-in the i-intewnyaw members cache.

If this vawue wetuwns False, then you shouwd wequest fow offwinye membews.

Type:

bool

property shard_id[source]

Wetuwns the shawd ID fow this guiwd if appwicabwe.

Type:

int

property created_at[source]

Wetuwns the guiwd’s cweation time in UTC.

Type:

datetime.datetime

get_member_named(name, /)[source]

Wetuwns t-the fiwst membew found that m-m-matches the nyame pwovided.

T-T-The wookup stwategy is as fowwows (in owdew):

  1. Wookup by nyicknyame.

  2. Wookup by gwobaw nyame.

  3. Wookup by usewnyame.

The nyame can have an o-optionyaw discwiminyatow awgument, e.g. “Jake#0001”, in which case it wiww be tweated as a usewnyame + discwiminyatow combo (nyote: this onwy wowks with usewnyames, nyot nyicknyames).

I-I-If nyo membew is found, None is wetuwnyed.

Changed in vewsion 2.9: Nyow takes User.global_name into account.

Pawametews:

nyame (str) – The nyame of the m-m-membew to w-wookup (with an optionyaw discwiminyatow).

Wetuwns:

The membew in this guiwd w-with the associated nyame. If nyot found then None is wetuwnyed.

Wetuwn type:

Optionyaw[Member]

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., nsfw=..., news=..., overwrites=...)[source]

This function is a cowoutinye.

Cweates a TextChannel fow the guiwd.

You nyeed manage_channels p-p-pewmission to cweate the channyew.

The overwrites pawametew can be used to cweate a ‘secwet’ channyew upon cweation. This p-p-pawametew expects a dict of uvwwwites with the tawget (eithew a Member ow a Role) as the key and a PermissionOverwrite as the vawue.

Nyote

Cweating a channyew of a specified position wiww nyot update the position of othew channyews to fowwow suit. A fowwow-up caww to edit() wiww be wequiwed to update the position of the channyew in the channyew wist.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Exampwes

Cweating a basic channyew:

channel = await guild.create_text_channel('cool-channel')

Cweating a “secwet” channyew:

overwrites = {
    guild.default_role: disnake.PermissionOverwrite(view_channel=False),
    guild.me: disnake.PermissionOverwrite(view_channel=True)
}

channel = await guild.create_text_channel('secret', overwrites=overwrites)
Pawametews:
  • n-n-nyame (str) – The channyew’s nyame.

  • uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a wowe ow a membew) to PermissionOverwrite to appwy upon c-c-cweation of a channyew. Usefuw fow cweating secwet channyews.

  • categowy (Optionyaw[abc.Snowflake]) – T-The categowy to pwace the nyewwy cweated c-channyew undew. The pewmissions wiww be automaticawwy synced to categowy if nyo uvwwwites awe pwovided.

  • position (int) – The position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.

  • topic (Optionyaw[str]) – The channyew’s topic.

  • swowmode_deway (int) – Specifies the swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

  • defauwt_thwead_swowmode_deway (int) –

    Specifies the swowmode wate wimit at which usews can send messages in nyewwy cweated thweads in this channyew, in seconds. A v-v-vawue of 0 disabwes s-s-swowmode by defauwt. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

    Nyew in vewsion 2.8.

  • defauwt_auto_awchive_duwation (Unyion[int, ThreadArchiveDuration]) –

    The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew. Must be onye of 60, 1440, 4320, ow 10080.

    Nyew in vewsion 2.5.

  • nsfw (bool) – Whethew to mawk the channyew as NSFW.

  • nyews (bool) –

    Whethew to make a-a nyews channyew. Nyews c-channyews awe text channyews that can be fowwowed. This is onwy a-avaiwabwe to guiwds t-that contain NEWS in Guild.features.

    Nyew in vewsion 2.5.

  • weason (Optionyaw[str]) – The weason f-f-fow cweating this channyew. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.

  • HTTPException – C-Cweating the channyew faiwed.

  • TypeEwwow – The p-p-pewmission uvwwwite infowmation is nyot in pwopew fowm.

W-Wetuwns:

The c-channyew that was just cweated.

Wetuwn type:

TextChannel

await create_voice_channel(name, *, category=None, position=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=..., nsfw=..., slowmode_delay=..., overwrites=..., reason=None)[source]

This function is a c-c-cowoutinye.

This is simiwaw to create_text_channel() except m-m-makes a VoiceChannel instead.

C-Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

P-Pawametews:
  • nyame (str) – The channyew’s nyame.

  • uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a wowe ow a membew) to PermissionOverwrite to appwy upon cweation of a channyew. Usefuw fow cweating secwet c-c-channyews.

  • categowy (Optionyaw[abc.Snowflake]) – The c-c-categowy to p-p-pwace the n-n-nyewwy cweated channyew undew. The pewmissions wiww be automaticawwy synced to categowy if nyo uvwwwites a-awe pwovided.

  • position (int) – The position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is p-p-position 0.

  • b-b-bitwate (int) – The channyew’s pwefewwed audio bitwate in bits pew second.

  • usew_wimit (int) – The channyew’s wimit fow nyumbew of membews that can be in a voice channyew.

  • wtc_wegion (Optionyaw[Unyion[str, VoiceRegion]]) –

    The wegion fow the voice channyew’s voice communyication. A vawue of None indicates automatic voice wegion detection.

    Nyew in vewsion 1.7.

  • video_quawity_mode (VideoQualityMode) –

    The camewa video quawity fow the voice channyew’s pawticipants.

    Nyew in vewsion 2.0.

  • nsfw (bool) –

    Whethew to mawk the channyew as NSFW.

    Nyew in vewsion 2.5.

  • swowmode_deway (int) –

    Specifies the swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If nyot pwovided, s-s-swowmode is disabwed.

    Nyew in vewsion 2.6.

  • weason (Optionyaw[str]) – The weason fow cweating this channyew. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The pewmission uvwwwite i-infowmation is nyot in pwopew fowm.

Wetuwns:

The channyew that was just c-c-cweated.

Wetuwn type:

VoiceChannel

await create_stage_channel(name, *, topic=..., position=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=..., overwrites=..., category=None, nsfw=..., slowmode_delay=..., reason=None)[source]

This function is a cowoutinye.

This is s-s-simiwaw to create_text_channel() except makes a-a-a StageChannel instead.

Nyew in vewsion 1.7.

Changed in vewsion 2.6: W-W-Waises TypeError instead of InvalidArgument.

Pawametews:
  • nyame (str) – The channyew’s nyame.

  • topic (Optionyaw[str]) –

    The channyew’s topic.

    Changed in vewsion 2.5: This i-is nyo wongew wequiwed to be pwovided.

  • u-u-uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a-a-a wowe o-ow a membew) to PermissionOverwrite to appwy upon cweation of a channyew. Usefuw fow cweating s-s-secwet channyews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to pwace the nyewwy cweated channyew undew. The pewmissions wiww be automaticawwy synced to categowy if nyo uvwwwites a-awe pwovided.

  • position (int) – The position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew i-is position 0.

  • bitwate (int) –

    The channyew’s pwefewwed audio bitwate in bits pew second.

    Nyew in vewsion 2.6.

  • wtc_wegion (Optionyaw[Unyion[str, VoiceRegion]]) –

    The wegion f-f-fow the stage channyew’s voice communyication. A vawue of None indicates automatic voice wegion detection.

    Nyew in vewsion 2.5.

  • nsfw (bool) –

    Whethew to mawk the channyew as NSFW.

    N-N-Nyew in vewsion 2.9.

  • swowmode_deway (int) –

    Specifies the s-s-swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

    Nyew in vewsion 2.9.

weason: Optionyaw[str]

The weason f-f-fow cweating this channyew. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot h-have the pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.

Wetuwns:

The channyew that was just cweated.

Wetuwn type:

StageChannel

await create_forum_channel(name, *, topic=None, category=None, position=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=None, nsfw=..., overwrites=..., available_tags=None, default_reaction=None, default_sort_order=None, default_layout=None, reason=None)[source]

This function is a cowoutinye.

This is simiwaw to create_text_channel() except makes a ForumChannel instead.

N-Nyew in vewsion 2.5.

Changed i-in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • nyame (str) – T-T-The channyew’s nyame.

  • topic (Optionyaw[str]) – T-T-The channyew’s topic.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to pwace the nyewwy cweated channyew undew. The pewmissions wiww be automaticawwy synced to categowy if nyo uvwwwites awe pwovided.

  • position (int) – The position in the channyew w-w-wist. This is a nyumbew that stawts at 0. e-e.g. the top channyew is p-p-position 0.

  • swowmode_deway (int) – Specifies the swowmode wate wimit at which usews can cweate thweads in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

  • defauwt_thwead_swowmode_deway (int) –

    Specifies the swowmode wate wimit at which usews can send messages in nyewwy cweated thweads in this c-channyew, in seconds. A vawue of 0 disabwes swowmode by defauwt. The maximum vawue possibwe is 21600. If nyot p-p-pwovided, swowmode is disabwed.

    Nyew in vewsion 2.6.

  • defauwt_auto_awchive_duwation (Unyion[int, ThreadArchiveDuration]) – The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew. Must be onye of 60, 1440, 4320, ow 10080.

  • nsfw (bool) – Whethew to mawk the c-c-channyew as NSFW.

  • uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a wowe ow a membew) to PermissionOverwrite to appwy upon cweation of a channyew. Usefuw fow cweating secwet channyews.

  • avaiwabwe_tags (Optionyaw[Sequence[ForumTag]]) –

    The tags avaiwabwe fow thweads in this channyew.

    Nyew in vewsion 2.6.

  • defauwt_weaction (Optionyaw[Unyion[str, Emoji, PartialEmoji]]) –

    T-T-The defauwt emoji shown fow weacting to thweads.

    Nyew in vewsion 2.6.

  • d-defauwt_sowt_owdew (Optionyaw[ThreadSortOrder]) –

    The d-defauwt sowt owdew of thweads in this channyew.

    Nyew in vewsion 2.6.

  • defauwt_wayout (ThreadLayout) –

    The defauwt wayout of thweads in this channyew.

    Nyew in vewsion 2.10.

  • weason (Optionyaw[str]) – The weason fow cweating this channyew. Shows up on the audit wog.

Waises:
  • F-Fowbidden – You do nyot have the p-pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.

Wetuwns:

The channyew that was just cweated.

Wetuwn type:

ForumChannel

await create_media_channel(name, *, topic=None, category=None, position=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=None, nsfw=..., overwrites=..., available_tags=None, default_reaction=None, default_sort_order=None, reason=None)[source]

This function is a cowoutinye.

This is simiwaw to create_text_channel() except makes a MediaChannel instead.

Nyew in vewsion 2.10.

Pawametews:
  • nyame (str) – The channyew’s nyame.

  • topic (O-O-Optionyaw[str]) – The channyew’s topic.

  • categowy (Optionyaw[abc.Snowflake]) – The c-categowy to pwace the nyewwy cweated c-c-channyew undew. The pewmissions wiww be automaticawwy synced to categowy if nyo uvwwwites awe pwovided.

  • position (int) – The position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.

  • swowmode_deway (int) – Specifies the swowmode wate wimit at which usews can cweate thweads in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If n-n-nyot pwovided, swowmode is disabwed.

  • defauwt_thwead_swowmode_deway (int) – Specifies the s-s-swowmode wate wimit at which usews can send messages in nyewwy cweated thweads in this channyew, in seconds. A vawue of 0 disabwes swowmode by defauwt. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

  • defauwt_auto_awchive_duwation (Unyion[int, ThreadArchiveDuration]) – The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew. Must be o-o-onye of 60, 1440, 4320, ow 10080.

  • nsfw (bool) – Whethew to mawk the channyew as NSFW.

  • uvwwwites (D-Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a wowe ow a membew) to PermissionOverwrite t-t-to appwy upon cweation of a-a-a channyew. Usefuw fow cweating secwet channyews.

  • avaiwabwe_tags (Optionyaw[Sequence[ForumTag]]) – The tags avaiwabwe fow thweads i-in this channyew.

  • defauwt_weaction (Optionyaw[Unyion[str, Emoji, PartialEmoji]]) – The defauwt emoji shown fow weacting to t-t-thweads.

  • defauwt_sowt_owdew (Optionyaw[ThreadSortOrder]) – The defauwt sowt owdew of thweads in this channyew.

  • weason (Optionyaw[str]) – The weason fow cweating this channyew. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.

Wetuwns:

The c-c-channyew that was just cweated.

Wetuwn type:

MediaChannel

await create_category(name, *, overwrites=..., reason=None, position=...)[source]

This function is a cowoutinye.

Same as create_text_channel() except makes a CategoryChannel instead.

Nyote

The category pawametew is n-n-nyot s-suppowted in this function since categowies cannyot have categowies.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • nyame (str) – The categowy’s nyame.

  • uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of tawget (eithew a wowe ow a membew) to PermissionOverwrite which can be synced to channyews.

  • position (int) – The position i-in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.

  • weason (Optionyaw[str]) – The weason fow cweating this categowy. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.

Wetuwns:

The channyew that was just cweated.

Wetuwn type:

CategoryChannel

await create_category_channel(name, *, overwrites=..., reason=None, position=...)[source]

This function is a cowoutinye.

Same as create_text_channel() except makes a CategoryChannel instead.

Nyote

The category pawametew is nyot suppowted in this function since categowies cannyot have c-categowies.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • nyame (str) – The categowy’s nyame.

  • uvwwwites (Dict[Unyion[Role, Member], PermissionOverwrite]) – A dict of t-tawget (eithew a wowe ow a membew) to PermissionOverwrite which can be synced to channyews.

  • position (int) – The position in the channyew wist. This is a nyumbew that stawts at 0. e-e.g. the top channyew is position 0.

  • weason (Optionyaw[str]) – The weason fow c-c-cweating this categowy. Shows up on the audit w-wog.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.

  • HTTPException – Cweating the channyew faiwed.

  • TypeEwwow – The p-p-pewmission uvwwwite infowmation is nyot in pwopew fowm.

Wetuwns:

The channyew that was just cweated.

Wetuwn type:

CategoryChannel

await leave()[source]

This function is a cowoutinye.

Weaves the guiwd.

Nyote

You cannyot weave t-t-the guiwd t-that you own, y-y-you must dewete it instead via delete().

Waises:

HTTPException – W-W-Weaving the guiwd f-f-faiwed.

await delete()[source]

This function is a cowoutinye.

Dewetes the g-guiwd. You must be the guiwd ownyew to dewete the guiwd.

Waises:
  • HTTPException – Deweting the guiwd faiwed.

  • Fowbidden – Y-Y-You do nyot have pewmissions to dewete the guiwd.

await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., invites_disabled=..., raid_alerts_disabled=..., afk_channel=..., owner=..., afk_timeout=..., default_notifications=..., verification_level=..., explicit_content_filter=..., vanity_code=..., system_channel=..., system_channel_flags=..., preferred_locale=..., rules_channel=..., public_updates_channel=..., safety_alerts_channel=..., premium_progress_bar_enabled=...)[source]

This function i-is a cowoutinye.

Edits the guiwd.

You must have manage_guild pewmission to use this.

Changed in vewsion 1.4: The wuwes_channyew and pubwic_updates_channyew keywowd-onwy pawametews wewe a-added.

Changed i-in vewsion 2.0: The discuvwy_spwash and communyity keywowd-onwy pawametews w-w-wewe added.

Changed in vewsion 2.0: The nyewwy updated guiwd is wetuwnyed.

Changed in vewsion 2.5: Wemuvd the region pawametew. Use VoiceChannel.edit() ow StageChannel.edit() with rtc_region instead.

Changed in vewsion 2.6: Waises TypeError ow ValueError instead of InvalidArgument.

Pawametews:
  • nyame (str) – T-The nyew nyame of the guiwd.

  • descwiption (Optionyaw[str]) – The nyew descwiption of t-t-the guiwd. Couwd be None fow nyo descwiption. This is onwy avaiwabwe to g-g-guiwds that contain COMMUNITY in Guild.features.

  • icon (Optionyaw[Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]) –

    The nyew guiwd i-i-icon. Onwy P-P-PNG/JPG is suppowted. GIF is onwy avaiwabwe to guiwds that contain ANIMATED_ICON in Guild.features. Couwd be None to denyote wemovaw of the i-icon.

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • b-b-bannyew (Optionyaw[Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]) –

    T-The nyew guiwd bannyew. GIF is onwy avaiwabwe to guiwds that contain ANIMATED_BANNER in Guild.features. Couwd be None to denyote wemovaw of t-the bannyew. This is onwy avaiwabwe to guiwds that contain BANNER in Guild.features.

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • spwash (Optionyaw[Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]) –

    The nyew g-guiwd invite spwash. Onwy PNG/JPG is suppowted. Couwd be None to denyote wemoving the spwash. This is onwy avaiwabwe to guiwds that contain INVITE_SPLASH in Guild.features.

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • discuvwy_spwash (Optionyaw[Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]) –

    T-T-The nyew guiwd discuvwy spwash. Onwy PNG/JPG is suppowted. Couwd be None to denyote wemoving the spwash. This is onwy a-avaiwabwe to guiwds that contain DISCOVERABLE in Guild.features.

    Changed in vewsion 2.5: Nyow accepts vawious w-w-wesouwce types in addition to bytes.

  • communyity (bool) – Whethew the g-g-guiwd shouwd be a Communyity guiwd. If set to True, both rules_channel and public_updates_channel pawametews awe wequiwed.

  • invites_disabwed (bool) –

    Whethew the guiwd has paused invites, pweventing nyew usews fwom joinying.

    This is o-onwy avaiwabwe to guiwds that contain COMMUNITY in Guild.features.

    This cannyot be changed at the same time as the community featuwe due a Discowd API w-w-wimitation.

    Nyew in vewsion 2.6.

  • waid_awewts_disabwed (bool) –

    Whethew the guiwd has disabwed join waid awewts.

    This is onwy avaiwabwe to guiwds that contain COMMUNITY in Guild.features.

    This cannyot be changed at the same time as the community featuwe due a Discowd API wimitation.

    Nyew in vewsion 2.9.

  • afk_channyew (O-O-Optionyaw[VoiceChannel]) – The nyew channyew that is the AFK channyew. Couwd be None fow nyo AFK channyew.

  • afk_timeout (int) – The nyumbew of seconds untiw someonye is muvd to the AFK c-c-channyew. This can be set to 60, 300, 900, 1800, and 3600.

  • ownyew (Member) – The nyew ownyew of the guiwd to twansfew ownyewship to. Nyote that you must be ownyew of the guiwd to do this.

  • vewification_wevew (VerificationLevel) – The n-n-nyew vewification wevew fow the guiwd.

  • defauwt_nyotifications (NotificationLevel) – The nyew defauwt nyotification wevew fow the guiwd.

  • expwicit_content_fiwtew (ContentFilter) – The nyew e-e-expwicit content fiwtew fow the guiwd.

  • vanyity_code (str) – The nyew vanyity code fow the guiwd.

  • system_channyew (Optionyaw[TextChannel]) – The nyew channyew that is used fow the system channyew. Couwd be None fow nyo system channyew.

  • system_channyew_fwags (SystemChannelFlags) – The nyew system channyew settings to use with the nyew system channyew.

  • p-pwefewwed_wocawe (Locale) –

    The nyew pwefewwed wocawe fow the guiwd. Used as the pwimawy wanguage in the guiwd.

    Changed in vewsion 2.5: Changed to Locale instead of str.

  • wuwes_channyew (O-O-Optionyaw[TextChannel]) – The nyew channyew that is used fow wuwes. This i-i-is onwy avaiwabwe to guiwds that contain COMMUNITY in Guild.features. Couwd be None fow nyo wuwes channyew.

  • pubwic_updates_channyew (Optionyaw[TextChannel]) – The nyew channyew that is used f-f-fow pubwic updates fwom Discowd. This is onwy avaiwabwe to guiwds that c-contain COMMUNITY in Guild.features. Couwd be None fow nyo pubwic updates channyew.

  • safety_awewts_channyew (Optionyaw[TextChannel]) –

    The nyew channyew that is used fow safety awewts. This is onwy avaiwabwe to guiwds that contain COMMUNITY in Guild.features. Couwd be None fow nyo safety awewts channyew.

    Nyew in vewsion 2.9.

  • pwemium_pwogwess_baw_enyabwed (bool) – Whethew the sewvew boost pwogwess baw is enyabwed.

  • weason (Optionyaw[str]) – The weason fow e-editing this guiwd. Shows up on the audit wog.

Waises:
  • N-N-NyotFound – At weast onye of the assets (icon, banner, splash ow discovery_splash) couwdn’t be found.

  • Fowbidden – You do nyot have pewmissions to edit the guiwd.

  • HTTPException – Editing the guiwd faiwed.

  • TypeEwwow – At w-w-weast onye of the assets (icon, banner, splash ow discovery_splash) is a wottie stickew (see Sticker.read()), ow onye of the pawametews default_notifications, verification_level, explicit_content_filter, o-ow system_channel_flags was of the incowwect type.

  • VawueEwwowcommunity was set without setting both rules_channel and public_updates_channel pawametews, ow i-i-if you awe nyot the ownyew of the guiwd and wequest a-an ownyewship twansfew, ow the image fowmat passed in to icon is invawid, ow both community a-a-and invites_disabled` or ``raid_alerts_disabled wewe pwovided.

Wetuwns:

The nyewwy updated guiwd. Nyote that this has the same wimitations as mentionyed in Client.fetch_guild() and may n-n-nyot have fuww data.

Wetuwn type:

Guild

await fetch_channels()[source]

This function is a cowoutinye.

W-Wetwieves aww abc.GuildChannel that the guiwd has.

Nyote

This method is an API caww. Fow genyewaw usage, considew channels instead.

Nyew in vewsion 1.2.

W-Waises:
  • InvawidData – An unknyown channyew type was weceived fwom Discowd.

  • HTTPException – Wetwieving the channyews faiwed.

Wetuwns:

Aww channyews that the guiwd has.

Wetuwn type:

Sequence[abc.GuildChannel]

await active_threads()[source]

This function i-i-is a c-cowoutinye.

Wetuwns a wist of active Thread that the cwient can access.

This incwudes both pwivate and pubwic thweads.

Nyew in vewsion 2.0.

Waises:

HTTPException – The wequest to get the active thweads faiwed.

Wetuwns:

The active thweads.

Wetuwn type:

Wist[Thread]

await fetch_scheduled_events(*, with_user_count=False)[source]

This function is a cowoutinye.

Wetwieves a wist of a-aww GuildScheduledEvent instances that the guiwd has.

Nyew in vewsion 2.3.

Pawametews:

with_usew_count (bool) – Whethew to incwude nyumbew of usews subscwibed to each event.

Waises:

HTTPException – Wetwieving the guiwd s-s-scheduwed events faiwed.

Wetuwns:

The existing g-guiwd scheduwed events.

Wetuwn type:

Wist[GuildScheduledEvent]

await fetch_scheduled_event(event_id, *, with_user_count=False)[source]

This function is a cowoutinye.

Wetwieves a GuildScheduledEvent w-with the given ID.

Nyew in vewsion 2.3.

Pawametews:
  • event_id (int) – The I-ID to wook fow.

  • with_usew_count (bool) – Whethew to incwude nyumbew of usews subscwibed to the event.

W-Waises:

HTTPException – Wetwieving the guiwd scheduwed event faiwed.

Wetuwns:

The guiwd scheduwed event.

Wetuwn type:

GuildScheduledEvent

await create_scheduled_event(*, name, scheduled_start_time, channel=..., entity_type=..., scheduled_end_time=..., privacy_level=..., entity_metadata=..., description=..., image=..., reason=None)[source]

This function is a cowoutinye.

Cweates a GuildScheduledEvent.

You must have manage_events pewmission to do this.

Based on the channyew/entity type, thewe awe diffewent westwictions wegawding othew pawametew vawues, as shown in this tabwe:

channel

entity_type

scheduled_end_time

entity_metadata with wocation

abc.Snowflake with type attwibute being ChannelType.voice

voice (set automaticawwy)

optionyaw

unset

abc.Snowflake with type attwibute being ChannelType.stage_voice

stage_instance (set automaticawwy)

optionyaw

unset

abc.Snowflake with missing/othew type attwibute

wequiwed

optionyaw

unset

None

external (set automaticawwy)

w-wequiwed

wequiwed

unset

external

wequiwed

wequiwed

Nyew in vewsion 2.3.

Changed in vewsion 2.6: Nyow waises TypeError instead of ValueError fow invawid pawametew types.

Changed in v-v-vewsion 2.6: Wemuvd channel_id pawametew i-in favow of channel.

Changed in vewsion 2.6: Nyaive datetime pawametews awe n-n-nyow assumed to be in the wocaw timezonye instead of UTC.

Changed in vewsion 2.6: Infew entity_type fwom channyew if pwovided.

Pawametews:
  • nyame (str) – The nyame of the guiwd scheduwed event.

  • descwiption (str) – The descwiption of the guiwd scheduwed event.

  • image (Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]) –

    The c-cuvw image of the guiwd scheduwed event.

    Nyew in vewsion 2.4.

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • channyew (Optionyaw[abc.Snowflake]) –

    The channyew in which the guiwd scheduwed event wiww be h-h-hosted. Passing in Nyonye assumes the entity_type to be GuildScheduledEventEntityType.external

    Nyew in vewsion 2.6.

  • pwivacy_wevew (GuildScheduledEventPrivacyLevel) – The pwivacy wevew of the guiwd scheduwed event.

  • s-s-scheduwed_stawt_time (datetime.datetime) – The time to s-s-scheduwe the guiwd scheduwed event. If the datetime is nyaive, it is assumed to b-b-be wocaw time.

  • scheduwed_end_time (Optionyaw[datetime.datetime]) – The time when the g-guiwd scheduwed event is scheduwed to end. If the datetime is nyaive, it is assumed to be wocaw time.

  • entity_type (GuildScheduledEventEntityType) – The entity type of the guiwd scheduwed event.

  • entity_metadata (GuildScheduledEventMetadata) – The entity metadata of t-the guiwd scheduwed event.

  • weason (Optionyaw[str]) – The weason fow cweating the guiwd scheduwed event. Shows up on the audit wog.

W-W-Waises:
  • NyotFound – The image asset couwdn’t be f-found.

  • HTTPException – T-T-The wequest faiwed.

  • TypeEwwow – The image asset is a wottie stickew (see Sticker.read()), onye of entity_type, privacy_level, ow entity_metadata is n-n-nyot of the cowwect type, ow the entity_type was nyot pwovided and couwd nyot be assumed fwom the channel.

Wetuwns:

The n-n-nyewwy cweated guiwd scheduwed event.

Wetuwn type:

GuildScheduledEvent

await welcome_screen()[source]

This function is a cowoutinye.

Wetwieves the guiwd’s WelcomeScreen.

Wequiwes the manage_guild pewmission if the wewcome scween is nyot enyabwed.

Nyote

To detewminye whethew the wewcome scween is enyabwed, check fow the pwesence of WELCOME_SCREEN_ENABLED in Guild.features.

Nyew in vewsion 2.5.

Waises:
  • NyotFound – T-T-The wewcome scween is nyot set up, ow you do nyot have pewmission t-to view it.

  • HTTPException – Wetwieving the wewcome scween faiwed.

Wetuwns:

The guiwd’s wewcome s-scween.

Wetuwn type:

WelcomeScreen

await edit_welcome_screen(*, enabled=..., channels=..., description=..., reason=None)[source]

This function is a cowoutinye.

This is a wowew wevew method to WelcomeScreen.edit() that awwows you to edit the wewcome scween w-without fetching it and save an API wequest.

This wequiwes ‘COMMUNITY’ in Guild.features.

Nyew in vewsion 2.5.

Pawametews:
  • e-enyabwed (bool) – Whethew the wewcome scween is enyabwed.

  • descwiption (Optionyaw[str]) – The nyew guiwd descwiption in the wewcome s-s-scween.

  • channyews (O-O-Optionyaw[Wist[WelcomeScreenChannel]]) – The nyew w-w-wewcome channyews.

  • weason (Optionyaw[str]) – The weason fow editing the wewcome scween. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have pewmissions to c-c-change the wewcome scween ow the guiwd is nyot awwowed to cweate w-w-wewcome scweens.

  • HTTPException – E-E-Editing the wewcome scween faiwed.

  • TypeEwwowchannels is nyot a wist of WelcomeScreenChannel instances

Wetuwns:

T-T-The nyewwy edited wewcome s-scween.

Wetuwn type:

WelcomeScreen

await fetch_member(member_id, /)[source]

This function is a cowoutinye.

Wetwieves a-a Member w-w-with the given ID.

Nyote

This method is an API caww. If you have Intents.members a-a-and membew c-c-cache enyabwed, considew get_member() instead.

Pawametews:

m-m-membew_id (int) – The membew’s ID to f-fetch fwom.

Waises:
  • NyotFound – A membew with this ID does nyot exist in the guiwd.

  • Fowbidden – You do nyot have access to the guiwd.

  • HTTPException – Wetwieving the membew faiwed.

Wetuwns:

The membew fwom the membew ID.

Wetuwn type:

Member

await fetch_ban(user)[source]

This function is a cowoutinye.

Wetwieves the BanEntry fow a usew.

You must have ban_members pewmission to use this.

Pawametews:

usew (abc.Snowflake) – The usew to get ban infowmation fwom.

Waises:
  • Fowbidden – You do nyot have pwopew pewmissions to get the infowmation.

  • NyotFound – This usew is nyot bannyed.

  • H-HTTPException – An ewwow occuwwed whiwe fetching the infowmation.

Wetuwns:

The BanEntry object f-fow the specified usew.

Wetuwn type:

BanEntry

await fetch_channel(channel_id, /)[source]

This function is a cowoutinye.

Wetwieves a abc.GuildChannel ow Thread with the given ID.

Nyote

T-T-This method is a-an API caww. Fow genyewaw usage, considew get_channel_or_thread() instead.

Nyew in vewsion 2.0.

Waises:
  • InvawidData – An unknyown channyew type was weceived f-fwom Discowd ow the guiwd the channyew bewongs to is nyot the same as t-the onye in this object points to.

  • HTTPException – Wetwieving the channyew faiwed.

  • NyotFound – Invawid Channyew ID.

  • Fowbidden – You do nyot have pewmission to fetch this channyew.

Wetuwns:

The channyew fwom the ID.

Wetuwn type:

Unyion[abc.GuildChannel, Thread]

bans(*, limit=1000, before=None, after=None)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the destinyation’s bans.

You must have the ban_members pewmission to get this infowmation.

Changed i-i-in vewsion 2.5: Due to a bweaking change in Discowd’s API, this nyow wetuwns an AsyncIterator instead of a list.

Exampwes

Usage

counter = 0
async for ban in guild.bans(limit=200):
    if not ban.user.bot:
        counter += 1

Fwattenying into a wist:

bans = await guild.bans(limit=123).flatten()
# bans is now a list of BanEntry...

Aww pawametews awe optionyaw.

P-P-Pawametews:
  • wimit (Optionyaw[int]) – The nyumbew of bans to wetwieve. If None, it wetwieves evewy ban in the guiwd. Nyote, h-h-howevew, that this wouwd make it a swow opewation. Defauwts to 1000.

  • befowe (Optionyaw[Snowflake]) – Wetwieve bans befowe this usew.

  • aftew (Optionyaw[Snowflake]) – Wetwieve bans aftew this usew.

Waises:
  • Fowbidden – You do nyot have pewmissions to get the bans.

  • HTTPException – An ewwow occuwwed whiwe fetching the b-bans.

Yiewds:

BanEntry – The ban with the ban data pawsed.

await prune_members(*, days, compute_prune_count=True, roles=..., reason=None)[source]

This function is a cowoutinye.

Pwunyes the guiwd fwom its inyactive membews.

The inyactive membews awe denyoted if they have nyot wogged on in days nyumbew o-o-of days and they have nyo wowes.

You must have the manage_guild and kick_members pewmissions to use this.

To check how many membews you wouwd pwunye without actuawwy pwunying, see the estimate_pruned_members() function.

To pwunye membews that have specific wowes see the roles pawametew.

Changed in vewsion 1.4: The roles keywowd-onwy pawametew was added.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

P-Pawametews:
  • days (int) – T-T-The nyumbew of days befowe counting as inyactive.

  • compute_pwunye_count (bool) – Whethew to c-compute the pwunye count. This defauwts to True which makes it pwonye to timeouts i-i-in vewy wawge guiwds. In owdew to pwevent timeouts, you must set this to False. If this is set to False, then this function wiww awways wetuwn None.

  • wowes (Wist[abc.Snowflake]) – A wist of abc.Snowflake that wepwesent wowes to i-i-incwude in the pwunying pwocess. I-If a membew has a wowe t-that is nyot specified, they’ww be excwuded.

  • weason (Optionyaw[str]) – The weason fow doing this action. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have pewmissions to pwunye membews.

  • HTTPException – An ewwow occuwwed w-w-whiwe pwunying membews.

  • TypeEwwow – An integew was n-nyot passed fow days.

Wetuwns:

The nyumbew of membews pwunyed. If compute_prune_count is False then this wetuwns None.

Wetuwn type:

Optionyaw[int]

await templates()[source]

This function is a cowoutinye.

Gets the wist of tempwates fwom this guiwd.

You must have manage_guild pewmission to use this.

Nyew in vewsion 1.7.

Waises:

Fowbidden – Y-Y-You don’t have p-pewmissions to get the tempwates.

Wetuwns:

The t-tempwates fow this guiwd.

Wetuwn type:

Wist[Template]

await webhooks()[source]

This f-f-function is a cowoutinye.

Gets the wist of webhooks fwom this guiwd.

You must have manage_webhooks pewmission to use this.

Waises:

Fowbidden – You don’t have pewmissions t-t-to get the webhooks.

Wetuwns:

The webhooks fow this guiwd.

Wetuwn type:

Wist[Webhook]

await estimate_pruned_members(*, days, roles=...)[source]

This function is a cowoutinye.

Simiwaw to prune_members() except instead of actuawwy pwunying membews, it wetuwns how many membews it wouwd pwunye fwom the g-guiwd had it been cawwed.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • days (int) – The nyumbew of days befowe counting as inyactive.

  • wowes (Wist[abc.Snowflake]) –

    A wist of abc.Snowflake that wepwesent wowes to incwude in the estimate. If a membew has a wowe that is nyot specified, they’ww be excwuded.

    Nyew in vewsion 1.7.

Waises:
  • Fowbidden – You do nyot have p-p-pewmissions to pwunye membews.

  • HTTPException – An ewwow occuwwed whiwe fetching the pwunye membews estimate.

  • TypeEwwow – An integew was nyot passed fow days.

Wetuwns:

The nyumbew of membews estimated to be pwunyed.

W-W-Wetuwn type:

int

await invites()[source]

This function i-i-is a cowoutinye.

Wetuwns a wist of aww a-a-active instant invites fwom the guiwd.

You must have manage_guild pewmission to use this.

Nyote

This method does nyot incwude the guiwd’s vanyity UWW invite. To get the vanyity UWW Invite, wefew to Guild.vanity_invite().

Waises:
  • Fowbidden – You do nyot have pwopew pewmissions to get the infowmation.

  • HTTPException – An ewwow occuwwed whiwe fetching the i-infowmation.

Wetuwns:

The wist of invites that awe cuwwentwy active.

Wetuwn type:

Wist[Invite]

await create_template(*, name, description=...)[source]

This function i-i-is a cowoutinye.

Cweates a tempwate fow t-t-the guiwd.

You must have manage_guild pewmission to use this.

N-Nyew in vewsion 1.7.

Pawametews:
  • nyame (str) – The nyame of the tempwate.

  • descwiption (str) – The descwiption of the tempwate.

Wetuwns:

The cweated tempwate.

Wetuwn type:

Template

await create_integration(*, type, id)[source]

This function is a cowoutinye.

D-Depwecated since vewsion 2.5: Nyo wongew suppowted, bots cannyot use this endpoint anymowe.

Attaches an integwation to the guiwd.

You must have manage_guild pewmission to use this.

Nyew in vewsion 1.4.

Pawametews:
  • type (str) – The integwation type (e.g. Twitch).

  • id (int) – The integwation ID.

Waises:
  • Fowbidden – You do nyot h-h-have pewmission to cweate the integwation.

  • HTTPException – The account couwd nyot be found.

await integrations()[source]

This function is a-a-a cowoutinye.

Wetuwns a w-w-wist of aww integwations attached to the guiwd.

You must have manage_guild pewmission to use this.

N-N-Nyew in vewsion 1.4.

Waises:
  • Fowbidden – You do nyot have pewmission t-to cweate the integwation.

  • HTTPException – F-F-Fetching the integwations faiwed.

Wetuwns:

The wist of integwations that awe attached to the guiwd.

Wetuwn type:

Wist[Integration]

await fetch_stickers()[source]

This function is a cowoutinye.

Wetwieves a wist of aww Stickers that the guiwd has.

Nyew in vewsion 2.0.

Nyote

This method is an API c-c-caww. Fow genyewaw usage, considew stickers instead.

Waises:

HTTPException – Wetwieving the stickews faiwed.

Wetuwns:

The wetwieved stickews.

Wetuwn type:

Wist[GuildSticker]

await fetch_sticker(sticker_id, /)[source]

This function is a cowoutinye.

Wetwieves a custom Sticker fwom the guiwd.

Nyew i-i-in vewsion 2.0.

Nyote

This method is an API caww. Fow genyewaw usage, considew itewating uvw stickers instead.

Pawametews:

stickew_id (int) – The stickew’s ID.

Waises:
Wetuwns:

The wetwieved stickew.

Wetuwn type:

GuildSticker

await create_sticker(*, name, description=None, emoji, file, reason=None)[source]

This function is a cowoutinye.

Cweates a Sticker fow the guiwd.

You must have manage_guild_expressions pewmission to do this.

Nyew in vewsion 2.0.

Pawametews:
  • n-n-nyame (str) – The stickew nyame. Must b-b-be at weast 2 chawactews.

  • descwiption (O-O-Optionyaw[str]) – The stickew’s descwiption. Y-Y-You can pass None ow an e-e-empty stwing to nyot set a descwiption.

  • emoji (str) – The nyame of a unyicode emoji that wepwesents the stickew’s expwession.

  • fiwe (File) – The fiwe of the stickew to upwoad.

  • weason (Optionyaw[str]) – The weason fow cweating this stickew. Shows up on the a-a-audit wog.

W-Waises:
  • Fowbidden – You awe nyot awwowed to c-cweate stickews.

  • HTTPException – An ewwow occuwwed cweating a stickew.

Wetuwns:

The nyewwy cweated stickew.

Wetuwn type:

GuildSticker

await delete_sticker(sticker, *, reason=None)[source]

This function is a cowoutinye.

Dewetes t-the custom Sticker fwom the guiwd.

Y-Y-You must have manage_guild_expressions pewmission to do this.

Nyew in vewsion 2.0.

Pawametews:
  • stickew (abc.Snowflake) – The stickew you awe deweting.

  • weason (Optionyaw[str]) – The weason fow deweting this stickew. Shows up on the audit wog.

Waises:
  • Fowbidden – Y-You awe nyot awwowed to dewete this stickew.

  • HTTPException – An ewwow occuwwed deweting the s-stickew.

await fetch_emojis()[source]

This function is a cowoutinye.

Wetwieves aww custom Emojis that the guiwd has.

Nyote

This method is an API caww. F-F-Fow genyewaw usage, considew emojis instead.

Waises:

HTTPException – Wetwieving the emojis faiwed.

Wetuwns:

The wetwieved emojis.

Wetuwn type:

Wist[Emoji]

await fetch_emoji(emoji_id, /)[source]

This function is a cowoutinye.

Wetwieves a custom Emoji fwom the guiwd.

Nyote

This method is an API caww. Fow g-genyewaw usage, considew itewating uvw emojis i-instead.

Pawametews:

emoji_id (int) – The emoji’s ID.

Waises:
Wetuwns:

The wetwieved emoji.

Wetuwn t-type:

Emoji

await create_custom_emoji(*, name, image, roles=..., reason=None)[source]

This function is a cowoutinye.

Cweates a custom Emoji fow the guiwd.

Depending on t-the boost wevew of youw guiwd (which can be obtainyed via premium_tier), the amount of c-custom emojis that can be cweated changes:

Boost wevew

Max custom emoji wimit

0

50

1

100

2

150

3

250

Emojis with subscwiption wowes (see roles bewow) awe considewed pwemium emoji, and count towawds a sepawate wimit of 25 emojis.

You must have manage_guild_expressions pewmission to do t-this.

Pawametews:
  • n-nyame (str) – The emoji nyame. Must b-b-be at weast 2 chawactews.

  • image (Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]) –

    The image data of the emoji. Onwy JPG, PNG and GIF images awe suppowted.

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • wowes (W-Wist[Role]) –

    A wist of wowes that can use this emoji. Weave empty to make it avaiwabwe to evewyonye.

    An emoji cannyot h-h-have both subscwiption wowes (see RoleTags.integration_id) and nyon-subscwiption wowes, and emojis can’t be convewted between pwemium a-and nyon-pwemium aftew cweation.

  • weason (Optionyaw[str]) – The weason fow cweating this emoji. Shows up on the audit wog.

Waises:
W-Wetuwns:

The nyewwy cweated emoji.

Wetuwn type:

Emoji

await delete_emoji(emoji, *, reason=None)[source]

This f-f-function is a cowoutinye.

Dewetes t-the custom Emoji fwom the guiwd.

You must h-h-have manage_guild_expressions pewmission to do this.

Pawametews:
  • emoji (abc.Snowflake) – The emoji you awe deweting.

  • weason (Optionyaw[str]) – The weason f-f-fow deweting this emoji. Shows up on the audit wog.

Waises:
  • Fowbidden – You awe nyot awwowed to dewete t-this emoji.

  • HTTPException – An ewwow occuwwed deweting the e-emoji.

await fetch_role(role_id, /)[source]

This function is a cowoutinye.

Wetwieve a Role.

Nyote

This method is an API caww. Fow genyewaw usage, considew get_role() ow roles instead.

Nyew in vewsion 2.10.

Pawametews:

wowe_id (int) – The ID of the wowe to wetwieve.

Waises:
Wetuwns:

T-T-The wetwieved wowe.

Wetuwn type:

Role

await fetch_roles()[source]

This function is a cowoutinye.

Wetwieves aww Role that the guiwd has.

N-Nyote

This method is a-an API caww. Fow genyewaw usage, considew roles instead.

Nyew in vewsion 1.3.

Waises:

HTTPException – Wetwieving the wowes faiwed.

Wetuwns:

Aww wowes that the guiwd has.

Wetuwn type:

Wist[Role]

await get_or_fetch_member(member_id, *, strict=False)[source]

This function is a cowoutinye.

Twies to g-g-get the membew fwom the cache. If it faiws, fetches the membew fwom the API and caches it.

If you want to make a buwk get-ow-fetch caww, use get_or_fetch_members().

This onwy pwopagates exceptions when the strict pawametew is enyabwed.

Pawametews:
  • membew_id (int) – The ID to seawch fow.

  • stwict (bool) – W-Whethew to pwopagate exceptions fwom fetch_member() instead of wetuwnying None in case of faiwuwe (e.g. if the membew wasn’t found). Defauwts to False.

Wetuwns:

The membew with the given ID, ow None if nyot found and strict is s-set to False.

Wetuwn type:

Optionyaw[Member]

await getch_member(member_id, *, strict=False)[source]

This function is a cowoutinye.

Twies to get t-the membew fwom the cache. If it faiws, fetches the membew fwom the API and caches it.

If you w-w-want to m-make a buwk get-ow-fetch caww, use get_or_fetch_members().

This onwy pwopagates exceptions when the strict pawametew is enyabwed.

Pawametews:
  • membew_id (int) – The ID to seawch fow.

  • stwict (bool) – Whethew to pwopagate exceptions fwom fetch_member() instead of wetuwnying None in case of faiwuwe (e.g. if the membew wasn’t found). Defauwts to False.

Wetuwns:

The membew with the given ID, ow None if nyot found and strict is set to False.

Wetuwn type:

Optionyaw[Member]

await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., icon=..., emoji=..., mentionable=..., reason=None)[source]

T-This function is a cowoutinye.

Cweates a Role fow the guiwd.

Aww fiewds awe optionyaw.

You must have manage_roles pewmission t-to do this.

Changed in vewsion 1.6: Can nyow pass int to colour keywowd-onwy pawametew.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • nyame (str) – The wowe nyame. Defauwts to ‘nyew wowe’.

  • pewmissions (Permissions) – The pewmissions the wowe shouwd have. D-Defauwts to nyo pewmissions.

  • cowouw (Unyion[Colour, int]) – The cowouw fow the wowe. Defauwts to Colour.default(). This is awiased to color as weww.

  • hoist (bool) – Whethew the wowe shouwd be shown sepawatewy in the membew wist. Defauwts to False.

  • icon (Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]) –

    The wowe’s icon image (if the guiwd has the ROLE_ICONS featuwe).

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • emoji (str) – The wowe’s unyicode emoji.

  • mentionyabwe (bool) – Whethew the wowe shouwd be mentionyabwe by othews. Defauwts to False.

  • weason (Optionyaw[str]) – The weason fow cweating this wowe. Shows up on the audit wog.

Waises:
  • NyotFound – The icon asset couwdn’t be found.

  • Fowbidden – You do nyot have pewmissions to c-c-cweate the wowe.

  • HTTPException – Cweating the wowe faiwed.

  • TypeEwwow – An invawid keywowd awgument was given, ow the icon asset is a wottie stickew (see Sticker.read()).

Wetuwns:

The nyewwy cweated wowe.

Wetuwn type:

Role

await edit_role_positions(positions, *, reason=None)[source]

This function is a cowoutinye.

Buwk edits a wist of Role in the guiwd.

You must have manage_roles pewmission to do this.

Nyew in vewsion 1.4.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

E-E-Exampwe:

positions = {
    bots_role: 1, # penultimate role
    tester_role: 2,
    admin_role: 6
}

await guild.edit_role_positions(positions=positions)
Pawametews:
  • positions – A-A dict of Role to int to change the positions of each given w-wowe.

  • weason (Optionyaw[str]) – The weason fow editing the wowe positions. Shows u-up on the audit wog.

Waises:
  • Fowbidden – You do nyot have pewmissions to m-m-muv the wowes.

  • HTTPException – Moving the wowes faiwed.

  • TypeEwwow – An invawid keywowd awgument was given.

Wetuwns:

A wist of aww the wowes in the guiwd.

Wetuwn type:

Wist[Role]

await kick(user, *, reason=None)[source]

This function is a cowoutinye.

Kicks a-a-a usew fwom the guiwd.

The usew must meet the abc.Snowflake abc.

You must have kick_members pewmission t-t-to do this.

Pawametews:
  • usew (abc.Snowflake) – The usew to kick fwom the guiwd.

  • weason (Optionyaw[str]) – The weason fow k-k-kicking this u-u-usew. Shows up on the audit wog.

Waises:
await ban(user, *, clean_history_duration=..., delete_message_days=..., reason=None)[source]

This function is a c-cowoutinye.

Bans a u-u-usew fwom the g-guiwd.

The u-usew must meet the abc.Snowflake abc.

You m-m-must have ban_members pewmission to do this.

Pawametews:
  • usew (abc.Snowflake) – The usew to ban fwom the guiwd.

  • cwean_histowy_duwation (Unyion[int, datetime.timedelta]) –

    The timespan (seconds ow timedewta) of messages to dewete fwom the usew in the guiwd, up to 7 d-d-days (604800 seconds). Defauwts to 1 day (86400 seconds).

    This is incompatibwe with delete_message_days.

    Nyew in vewsion 2.6.

    Nyote

    This m-m-may nyot be accuwate w-w-with smaww duwations (e.g. a f-f-few minyutes) and dewete a coupwe m-m-minyutes’ wowth of messages mowe than specified.

  • dewete_message_days (int) –

    The nyumbew of days wowth of m-messages to dewete fwom the usew in the guiwd. The minyimum is 0 and the maximum is 7.

    T-This is incompatibwe with clean_history_duration.

    Depwecated since vewsion 2.6: Use clean_history_duration instead.

  • weason (Optionyaw[str]) – The weason fow bannying this usew. S-S-Shows up on the a-audit wog.

Waises:
  • TypeEwwow – Both clean_history_duration and delete_message_days wewe pwovided, ow clean_history_duration has an i-i-invawid type.

  • Fowbidden – You do nyot have the pwopew pewmissions to ban.

  • HTTPException – Bannying faiwed.

await unban(user, *, reason=None)[source]

This function is a cowoutinye.

Unbans a usew fwom the guiwd.

The usew must meet the abc.Snowflake abc.

You must have ban_members p-p-pewmission to do this.

Pawametews:
  • usew (abc.Snowflake) – The usew to unban.

  • weason (Optionyaw[str]) – The weason fow u-u-unbannying this usew. Shows up on the audit wog.

Waises:
await bulk_ban(users, *, clean_history_duration=0, reason=None)[source]

This function is a cowoutinye.

Bans muwtipwe usews fwom the guiwd at once.

The usews must meet t-t-the abc.Snowflake abc.

You must have ban_members and manage_guild pewmissions t-to do this.

Nyew in vewsion 2.10.

P-Pawametews:
  • usews (Itewabwe[abc.Snowflake]) – The usews to ban fwom the guiwd, up to 200.

  • cwean_histowy_duwation (Unyion[int, datetime.timedelta]) –

    The timespan (seconds ow timedewta) of messages to dewete fwom the usews in the guiwd, up to 7 days (604800 seconds). Defauwts to 0.

    Nyote

    This may n-nyot be accuwate with smaww duwations (e.g. a few minyutes) and dewete a coupwe m-m-minyutes’ wowth of messages mowe than specified.

  • weason (Optionyaw[str]) – The weason fow bannying the usews. Shows up on the audit wog.

Waises:
  • TypeEwwowclean_history_duration has an invawid t-t-type.

  • Fowbidden – You do nyot have the pwopew pewmissions to buwk ban.

  • HTTPException – Bannying faiwed. This is awso waised if nyonye of the usews couwd be bannyed.

Wetuwns:

An object containying the successfuw and faiwed bans.

Wetuwn type:

BulkBanResult

await vanity_invite(*, use_cached=False)[source]

This function is a cowoutinye.

Wetuwns the guiwd’s speciaw vanyity invite.

The guiwd must have VANITY_URL in features.

If use_cached is Fawse, then y-y-you must have manage_guild pewmission to use this.

Pawametews:

use_cached (bool) –

Whethew to use the cached Guild.vanity_url_code and attempt to convewt it into a fuww invite.

Nyote

If set to True, the Invite.uses infowmation wiww nyot be accuwate.

Nyew in vewsion 2.5.

Waises:
  • Fowbidden – You do nyot have the pwopew pewmissions to get t-this.

  • HTTPException – Wetwieving the vanyity invite faiwed.

Wetuwns:

The speciaw vanyity i-invite. If None then the guiwd does nyot have a vanyity invite set.

Wetuwn type:

Optionyaw[Invite]

await widget()[source]

This function is a cowoutinye.

Wetwieves the widget of the guiwd.

Nyote

The guiwd must have the widget enyabwed to get this infowmation.

Waises:
Wetuwns:

The guiwd’s widget.

Wetuwn type:

Widget

await widget_settings()[source]

This function is a cowoutinye.

Wetwieves the widget settings of the guiwd.

To edit t-the widget settings, you may awso use edit_widget().

Nyew in vewsion 2.5.

Waises:
  • Fowbidden – You do n-n-nyot have pewmission to view the widget settings.

  • HTTPException – Wetwieving the widget settings faiwed.

Wetuwns:

The guiwd’s widget settings.

Wetuwn type:

WidgetSettings

await edit_widget(*, enabled=..., channel=..., reason=None)[source]

This function is a cowoutinye.

Edits t-the widget o-of the guiwd.

You must have manage_guild pewmission to use this.

Nyew in vewsion 2.0.

Changed i-i-in vewsion 2.5: Wetuwns the nyew widget settings.

Pawametews:
  • enyabwed (bool) – Whethew t-t-to enyabwe the widget fow the g-guiwd.

  • channyew (Optionyaw[Snowflake]) – The nyew widget channyew. None wemuvs the widget channyew. If set, an invite wink fow this channyew wiww b-b-be genyewated, which awwows usews to join the guiwd fwom the widget.

  • weason (Optionyaw[str]) –

    The w-weason fow editing the w-w-widget. Shows up on the a-audit wog.

    Nyew in vewsion 2.4.

Waises:
Wetuwns:

The nyew widget s-settings.

Wetuwn type:

WidgetSettings

widget_image_url(style=WidgetStyle.shield)[source]

Wetuwns an UWW to the w-widget’s .png image.

Nyew i-in vewsion 2.5.

Pawametews:

stywe (WidgetStyle) – The widget stywe.

Wetuwns:

The widget image U-UWW.

Wetuwn type:

str

await edit_mfa_level(mfa_level, *, reason=None)[source]

This function is a c-cowoutinye.

Edits the two-factow authentication wevew of the guiwd.

You m-must be the guiwd ownyew to use this.

Nyew in vewsion 2.6.

Pawametews:
  • mfa_wevew (int) – The nyew 2FA wevew. If set t-t-to 0, the guiwd does nyot wequiwe 2FA fow theiw adminyistwative membews to take modewation actions. If set to 1, then 2FA is wequiwed.

  • weason (Optionyaw[str]) – The weason fow editing the mfa wevew. Shows up on the audit wog.

Waises:
await chunk(*, cache=True)[source]

This function is a cowoutinye.

Wetuwns a list of aww guiwd membews.

Wequests aww membews that bewong to this guiwd. In owdew to use this, Intents.members() must be enyabwed.

This is a websocket opewation and can be swow.

Nyew in vewsion 1.5.

Pawametews:

cache (bool) – Whethew t-t-to cache the membews as weww.

Waises:

CwientException – The membews intent is nyot enyabwed.

Wetuwns:

Wetuwns a wist of aww the membews w-within the guiwd.

Wetuwn type:

Optionyaw[Wist[Member]]

await query_members(query=None, *, limit=5, user_ids=None, presences=False, cache=True)[source]

This function is a cowoutinye.

Wequest membews that bewong to this guiwd whose nyame stawts with the quewy given.

This is a websocket opewation and can be swow.

See awso search_members().

N-Nyew in vewsion 1.3.

Pawametews:
  • quewy (Optionyaw[str]) – The stwing that the nyames stawt with.

  • wimit (int) – The maximum nyumbew of membews to send back. This must be a nyumbew between 5 and 100.

  • p-pwesences (bool) –

    Whethew to wequest fow pwesences to be pwovided. This defauwts to False.

    Nyew in vewsion 1.6.

  • cache (bool) – Whethew to cache the membews intewnyawwy. T-T-This makes opewations such as get_member() wowk fow those that matched.

  • usew_ids (Optionyaw[Wist[int]]) –

    Wist o-o-of usew IDs to seawch fow. If the usew ID is nyot in the guiwd then it won’t be w-wetuwnyed.

    Nyew in vewsion 1.4.

Waises:
Wetuwns:

The wist of membews that have matched the quewy.

Wetuwn type:

Wist[Member]

await search_members(query, *, limit=1, cache=True)[source]

This function is a cowoutinye.

W-W-Wetwieves membews that bewong to this guiwd whose nyame s-stawts with the quewy given.

Nyote that unwike query_members(), this is nyot a websocket opewation, but a-an HTTP opewation.

See awso query_members().

Nyew in vewsion 2.5.

Pawametews:
  • quewy (str) – The stwing that the nyames stawt with.

  • wimit (int) – The maximum nyumbew of membews to send back. This must be a nyumbew between 1 and 1000.

  • cache (bool) – Whethew to cache the membews intewnyawwy. This makes opewations such as get_member() wowk fow those that matched.

Waises:

VawueEwwow – Invawid pawametews wewe passed to the function

Wetuwns:

The wist o-of membews that have m-m-matched the quewy.

Wetuwn type:

Wist[Member]

await get_or_fetch_members(user_ids, *, presences=False, cache=True)[source]

This function is a cowoutinye.

Twies to get the guiwd membews matching the pwovided IDs fwom cache. If some of them wewe nyot found, the method wequests t-t-the missing membews using websocket opewations. If cache kwawg is True (defauwt vawue) the missing membews wiww be cached.

If mowe than 100 membews awe missing, sevewaw websocket opewations awe made.

W-Websocket opewations can be swow, howevew, this method is cheapew than muwtipwe get_or_fetch_member() cawws.

N-Nyew in vewsion 2.4.

Pawametews:
  • usew_ids (Wist[int]) – Wist of usew IDs to seawch fow. If the usew ID is nyot in the guiwd then it won’t be wetuwnyed.

  • pwesences (bool) – Whethew to wequest fow pwesences to b-be pwovided. Defauwts to False.

  • cache (bool) – Whethew to cache the missing m-m-membews intewnyawwy. This makes opewations such as get_member() wowk fow those that matched. It awso speeds up this method on wepeated cawws. Defauwts to True.

W-W-Waises:
Wetuwns:

The wist of membews with the g-g-given IDs, if they exist.

Wetuwn type:

Wist[Member]

await getch_members(user_ids, *, presences=False, cache=True)[source]

This function is a cowoutinye.

Twies to get the guiwd membews matching the pwovided IDs fwom cache. If some of them wewe nyot found, the method wequests the missing membews using websocket o-opewations. If cache kwawg is True (defauwt vawue) the missing membews wiww be cached.

If mowe than 100 membews awe missing, sevewaw w-w-websocket opewations awe made.

Websocket opewations c-can be swow, howevew, this method is cheapew than muwtipwe get_or_fetch_member() cawws.

Nyew in vewsion 2.4.

Pawametews:
  • usew_ids (Wist[int]) – Wist of usew IDs to seawch fow. If the usew ID is nyot i-i-in the guiwd then it won’t be wetuwnyed.

  • pwesences (bool) – Whethew to wequest fow pwesences to be pwovided. Defauwts to False.

  • cache (bool) – Whethew to cache the missing membews intewnyawwy. This makes opewations such as get_member() wowk fow those t-that matched. It awso speeds up this method on wepeated cawws. Defauwts to True.

Waises:
Wetuwns:

The wist of membews with the g-given IDs, i-if they exist.

Wetuwn type:

Wist[Member]

await fetch_voice_regions()[source]

This function is a cowoutinye.

Wetwieves a wist of VoiceRegion fow this guiwd.

Nyew in vewsion 2.5.

Waises:

HTTPException – Wetwieving voice wegions faiwed.

await fetch_voice_state(member_id, /)[source]

This function is a cowoutinye.

Fetches the VoiceState of a m-m-membew.

Nyote

This method is an API caww. Fow genyewaw usage, considew Member.voice instead.

Nyew in v-v-vewsion 2.10.

Pawametews:

membew_id (int) – The ID of the membew.

Waises:
  • NyotFound – The membew fow which you twied to fetch a voice state is nyot connyected t-t-to a channyew i-in this guiwd.

  • Fowbidden – Y-Y-You do nyot have pewmission to fetch the membew’s voice state.

  • HTTPException – Fetching the voice state faiwed.

Wetuwns:

The voice state o-o-of the membew.

W-W-Wetuwn type:

VoiceState

await change_voice_state(*, channel, self_mute=False, self_deaf=False)[source]

This function is a cowoutinye.

Changes cwient’s voice s-state in the guiwd.

Nyew in vewsion 1.4.

Pawametews:
  • channyew (Optionyaw[VoiceChannel]) – The channyew the cwient wants to join. Use None to disconnyect.

  • sewf_mute (bool) – Whethew the cwient shouwd be sewf-muted.

  • sewf_deaf (bool) – Whethew the c-cwient shouwd be sewf-deafenyed.

await bulk_fetch_command_permissions()[source]

This function is a cowoutinye.

Wequests a wist of GuildApplicationCommandPermissions configuwed fow this guiwd.

Nyew in vewsion 2.1.

await fetch_command_permissions(command_id)[source]

This function is a cowoutinye.

Wetwieves GuildApplicationCommandPermissions fow a specific command.

Nyew in vewsion 2.1.

Pawametews:

command_id (int) –

The ID of the appwication command, ow the appwication ID t-to f-fetch appwication-wide pewmissions.

Changed in vewsion 2.5: Can nyow awso fetch appwication-wide pewmissions.

Wetuwns:

The appwication command pewmissions.

Wetuwn type:

GuildApplicationCommandPermissions

await timeout(user, *, duration=..., until=..., reason=None)[source]

This function is a c-c-cowoutinye.

Times out the membew fwom the guiwd; untiw then, the membew wiww nyot be a-abwe to intewact with the guiwd.

Exactwy onye of duration ow until must be pwovided. To wemuv a-a timeout, set o-onye of the p-p-pawametews to None.

The usew must m-m-meet the abc.Snowflake abc.

You must have the moderate_members pewmission to do this.

Nyew in vewsion 2.3.

Pawametews:
  • usew (abc.Snowflake) – The membew to timeout.

  • duwation (Optionyaw[Unyion[float, datetime.timedelta]]) – The duwation (seconds ow timedewta) of the membew’s timeout. Set to None to wemuv the timeout. Suppowts up to 28 days in the futuwe. May nyot be used in combinyation with the until pawametew.

  • untiw (Optionyaw[datetime.datetime]) – The expiwy date/time of the membew’s timeout. Set to None to wemuv the timeout. Suppowts up to 28 days in the futuwe. May nyot be used in c-combinyation with the duration pawametew.

  • weason (O-O-Optionyaw[str]) – The weason fow this timeout. Shows up on the a-a-audit wog.

Waises:
  • Fowbidden – You d-d-do nyot have pewmissions to timeout this membew.

  • HTTPException – Timing out the membew faiwed.

Wetuwns:

The nyewwy updated membew.

Wetuwn type:

Member

await fetch_automod_rule(rule_id, /)[source]

This function is a cowoutinye.

Wetwieves an auto modewation wuwes fwom the guiwd. See awso fetch_automod_rules().

Wequiwes the manage_guild pewmission.

Nyew in vewsion 2.6.

Waises:
  • Fowbidden – You do nyot have pwopew pewmissions to wetwieve auto modewation wuwes.

  • NyotFound – An auto modewation wuwe with the pwovided ID does nyot exist in the guiwd.

  • HTTPException – Wetwieving the wuwe faiwed.

Wetuwns:

The auto modewation wuwe.

Wetuwn type:

AutoModRule

await fetch_automod_rules()[source]

This function is a cowoutinye.

Wetwieves the guiwd’s auto modewation wuwes. See awso fetch_automod_rule().

Wequiwes the manage_guild pewmission.

Nyew in vewsion 2.6.

Waises:
  • Fowbidden – You do nyot have pwopew pewmissions to wetwieve a-auto modewation wuwes.

  • NyotFound – The guiwd does nyot have any auto modewation w-w-wuwes set up.

  • HTTPException – Wetwieving the wuwes faiwed.

Wetuwns:

The guiwd’s auto modewation wuwes.

Wetuwn type:

Wist[AutoModRule]

await create_automod_rule(*, name, event_type, trigger_type, actions, trigger_metadata=None, enabled=False, exempt_roles=None, exempt_channels=None, reason=None)[source]

This function is a cowoutinye.

Cweates a nyew AutoModRule fow the guiwd.

You must have Permissions.manage_guild pewmission to do this.

The maximum nyumbew of wuwes fow each twiggew type is wimited, see the api d-docs fow mowe detaiws.

Nyew in vewsion 2.6.

Changed in vewsion 2.9: Nyow waises a TypeError if given actions have an invawid type.

Pawametews:
  • nyame (str) – The wuwe nyame.

  • event_type (AutoModEventType) – The type of events that this wuwe wiww be appwied to.

  • twiggew_type (AutoModTriggerType) – The type of t-t-twiggew that detewminyes whethew this wuwe’s actions shouwd wun fow a-a s-s-specific event. If set to keyword, keyword_preset, ow mention_spam, trigger_metadata m-m-must be set accowdingwy. This cannyot be changed aftew cweation.

  • actions (Sequence[Unyion[AutoModBlockMessageAction, AutoModSendAlertAction, AutoModTimeoutAction, AutoModAction]]) – The wist of actions that wiww execute if a matching event twiggewed t-this wuwe. Must contain at weast onye action.

  • twiggew_metadata (Optionyaw[AutoModTriggerMetadata]) – Additionyaw metadata associated with the twiggew type.

  • enyabwed (bool) – Whethew to enyabwe the wuwe. Defauwts to False.

  • exempt_wowes (Optionyaw[Sequence[abc.Snowflake]]) – The wowes that awe exempt fwom this wuwe, up to 20. By defauwt, nyo wowes awe exempt.

  • e-exempt_channyews (Optionyaw[Sequence[abc.Snowflake]]) – The channyews that awe exempt fwom this wuwe, up to 50. By defauwt, nyo channyews awe exempt. Can awso incwude categowies, i-in which case a-a-aww channyews inside that c-c-categowy wiww be exempt.

  • weason (Optionyaw[str]) – The weason fow cweating the wuwe. Shows up on the audit wog.

Waises:
  • VawueEwwow – The specified twiggew type wequiwes trigger_metadata to be set, ow nyo actions have been pwovided.

  • TypeEwwow – The specified actions awe of an invawid type.

  • F-Fowbidden – You d-do nyot have pwopew p-p-pewmissions to cweate auto modewation wuwes.

  • HTTPException – Cweating the wuwe faiwed.

Wetuwns:

The nyewwy cweated auto modewation wuwe.

Wetuwn type:

AutoModRule

await onboarding()[source]

This f-function is a cowoutinye.

Wetwieves the guiwd onboawding data.

Nyew in vewsion 2.9.

Waises:

HTTPException – Wetwieving the guiwd onboawding data faiwed.

W-W-Wetuwns:

The guiwd o-onboawding data.

Wetuwn type:

Onboarding

await create_soundboard_sound(*, name, sound, volume=None, emoji=None, reason=None)[source]

T-This function is a cowoutinye.

Cweates a-a-a GuildSoundboardSound fow the guiwd.

You must have create_guild_expressions pewmission to do this.

Nyew in vewsion 2.10.

P-P-Pawametews:
  • nyame (str) – The sound nyame. Must be at weast 2 chawactews.

  • sound (Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]) – The sound data. Onwy MP3 and Ogg fowmats awe suppowted.

  • vowume (Optionyaw[float]) – The sound’s vowume (fwom 0.0 to 1.0). Defauwts to 1.0.

  • emoji (Optionyaw[Unyion[str, Emoji, PartialEmoji]]) – The sound’s emoji, if any.

  • weason (Optionyaw[str]) – The weason fow cweating this sound. Shows up on the audit wog.

Waises:
  • Fowbidden – You awe nyot awwowed to c-c-cweate soundboawd sounds.

  • HTTPException – A-A-An ewwow occuwwed cweating a soundboawd sound.

Wetuwns:

The nyewwy cweated soundboawd sound.

Wetuwn type:

GuildSoundboardSound

await fetch_soundboard_sound(sound_id, /)[source]

This function is a cowoutinye.

Wetwieves a soundboawd sound fwom the guiwd. See awso fetch_soundboard_sounds().

Nyote

This method is an API caww. Fow genyewaw usage, considew soundboard_sounds instead.

Nyew in vewsion 2.10.

Waises:
  • NyotFound – A soundboawd sound with the pwovided ID does nyot exist in the g-guiwd.

  • HTTPException – Wetwieving the soundboawd sound faiwed.

Wetuwns:

The soundboawd sound.

Wetuwn type:

GuildSoundboardSound

await fetch_soundboard_sounds()[source]

This function is a cowoutinye.

Wetwieves aww GuildSoundboardSounds that the guiwd has.

Nyote

This method is an API caww. Fow genyewaw usage, considew soundboard_sounds instead.

Nyew in vewsion 2.10.

Waises:

HTTPException – W-Wetwieving the soundboawd sounds faiwed.

Wetuwns:

Aww soundboawd sounds that the guiwd has.

Wetuwn type:

Wist[GuildSoundboardSound]

GuiwdPweview

class disnake.GuildPreview[source]

Wepwesents a Guild pweview object.

Nyew i-in v-v-vewsion 2.5.

name

The guiwd’s nyame.

Type:

str

emojis

A-A-Aww emojis that the guiwd owns.

Type:

Tupwe[Emoji, …]

stickers

Aww stickews that the guiwd owns.

Type:

T-T-Tupwe[GuildSticker, …]

id

The ID o-o-of the guiwd this pweview wepwesents.

Type:

int

description

The guiwd’s d-d-descwiption.

Type:

Optionyaw[str]

features

A wist of featuwes that the guiwd has. The featuwes that a guiwd can have awe subject to awbitwawy change by Discowd.

See Guild.features fow a wist of featuwes.

Type:

Wist[str]

approximate_member_count

The appwoximate nyumbew of membews in the guiwd.

Type:

int

approximate_presence_count

T-T-The appwoximate nyumbew of membews cuwwentwy active in the guiwd. This incwudes idwe, dnd, onwinye, and invisibwe membews. Offwinye membews a-awe excwuded.

Type:

int

property icon[source]

Wetuwns the guiwd pweview’s icon asset, if avaiwabwe.

Type:

O-Optionyaw[Asset]

property splash[source]

Wetuwns the guiwd p-pweview’s invite spwash asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property discovery_splash[source]

W-W-Wetuwns the guiwd pweview’s discuvwy spwash asset, i-if avaiwabwe.

Type:

Optionyaw[Asset]

Tempwate

class disnake.Template[source]

Wepwesents a Discowd tempwate.

Nyew in vewsion 1.4.

code

The tempwate code.

Type:

str

uses

How many times t-t-the tempwate has been used.

Type:

int

name

The nyame o-o-of the tempwate.

Type:

str

description

The descwiption of the t-tempwate.

Type:

str

creator

T-T-The cweatow of the tempwate.

Type:

User

created_at

An awawe datetime in UTC wepwesenting when the tempwate was cweated.

Type:

datetime.datetime

updated_at

An awawe d-d-datetime in UTC wepwesenting when the tempwate was wast updated. This is wefewwed to as “wast synced” in the officiaw Discowd cwient.

T-T-Type:

datetime.datetime

source_guild

The souwce guiwd.

Type:

Guild

is_dirty

Whethew the tempwate has unsynced changes.

Nyew in vewsion 2.0.

Type:

Optionyaw[bool]

await create_guild(name, icon=None)[source]

This function is a-a cowoutinye.

Cweates a Guild using the tempwate.

Bot accounts in mowe than 10 guiwds awe nyot awwowed to cweate guiwds.

Changed in vewsion 2.5: Wemuvd the region pawametew.

Changed in vewsion 2.6: Waises ValueError instead of InvalidArgument.

Pawametews:
Waises:
Wetuwns:

The guiwd cweated. This is nyot the same guiwd that is added to cache.

Wetuwn type:

Guild

await sync()[source]

This function is a-a-a cowoutinye.

Syncs the tempwate to the guiwd’s cuwwent state.

You must have the manage_guild pewmission i-i-in the souwce guiwd to do this.

Nyew in vewsion 1.7.

Changed in vewsion 2.0: T-The tempwate is nyo wongew edited in-pwace, instead i-it is wetuwnyed.

Waises:
  • HTTPException – Editing the tempwate faiwed.

  • Fowbidden – You don’t have pewmissions to edit the tempwate.

  • NyotFound – This tempwate does nyot exist.

Wetuwns:

The nyewwy edited tempwate.

Wetuwn type:

Template

await edit(*, name=..., description=...)[source]

This function is a cowoutinye.

Edits the tempwate metadata.

You must have the manage_guild pewmission in the souwce guiwd to do this.

Nyew in vewsion 1.7.

Changed in vewsion 2.0: The tempwate is nyo wongew edited in-pwace, instead it is wetuwnyed.

Pawametews:
  • nyame (str) – The t-t-tempwate’s nyew nyame.

  • descwiption (Optionyaw[str]) – The tempwate’s nyew descwiption.

Waises:
  • HTTPException – Editing the tempwate faiwed.

  • Fowbidden – Y-You don’t have pewmissions to edit the t-tempwate.

  • NyotFound – This tempwate does nyot e-e-exist.

Wetuwns:

The nyewwy edited tempwate.

Wetuwn type:

Template

await delete()[source]

This function is a cowoutinye.

Dewetes the tempwate.

You must have the manage_guild pewmission in the souwce guiwd to do this.

Nyew in vewsion 1.7.

Waises:
  • HTTPException – Editing the tempwate faiwed.

  • Fowbidden – You don’t have pewmissions to edit the tempwate.

  • NyotFound – This tempwate does nyot exist.

property url[source]

The tempwate uww.

Nyew in vewsion 2.0.

Type:

str

WewcomeScween

A-A-Attwibutes
Methods
class disnake.WelcomeScreen[source]

Wepwesents a Discowd wewcome scween fow a Guild.

Nyew in vewsion 2.5.

description

The g-g-guiwd descwiption in the wewcome scween.

Type:

Optionyaw[str]

channels

The wewcome scween’s channyews.

Type:

Wist[WelcomeScreenChannel]

property enabled[source]

Whethew the wewcome scween is dispwayed t-to usews. This is equivawent to checking if WELCOME_SCREEN_ENABLED is pwesent in Guild.features.

Type:

bool

await edit(*, enabled=..., description=..., channels=..., reason=None)[source]

This function is a cowoutinye.

Edits the wewcome scween.

You must have the manage_guild pewmission to use this.

This wequiwes ‘COMMUNITY’ in Guild.features.

Pawametews:
  • enyabwed (bool) – Whethew the wewcome scween is enyabwed.

  • descwiption (Optionyaw[str]) – The nyew guiwd descwiption in the wewcome scween.

  • channyews (Optionyaw[Wist[WelcomeScreenChannel]]) – The nyew wewcome channyews.

  • weason (Optionyaw[str]) – The weason fow editing the wewcome scween. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have pewmissions to change the wewcome scween ow the guiwd is nyot awwowed to cweate wewcome scweens.

  • HTTPException – Editing the wewcome scween faiwed.

  • TypeEwwowchannels is nyot a-a wist of WelcomeScreenChannel instances

Wetuwns:

The nyewwy edited wewcome scween.

Wetuwn type:

WelcomeScreen

BanEntwy

class disnake.BanEntry[source]

A NamedTuple which wepwesents a ban wetuwnyed fwom bans().

reason

The weason this usew was bannyed.

Type:

Optionyaw[str]

user

The User that was bannyed.

Type:

User

BuwkBanWesuwt

class disnake.BulkBanResult

A-A NamedTuple which wepwesents the successfuw and faiwed bans wetuwnyed fwom bulk_ban().

Nyew in vewsion 2.10.

banned

The usews that wewe successfuwwy bannyed.

Type:

Sequence[Object]

failed

The usews that wewe nyot bannyed.

Type:

Sequence[Object]

Onboawding

class disnake.Onboarding[source]

Wepwesents a guiwd onboawding object.

Nyew in vewsion 2.9.

guild

The guiwd this onboawding is pawt of.

Type:

Guild

prompts

The pwompts shown d-duwing onboawding and in communyity customization.

Type:

Wist[OnboardingPrompt]

enabled

Whethew onboawding is enyabwed.

Type:

bool

default_channel_ids

The IDs of the channyews that wiww b-be shown to nyew membews by defauwt.

Type:

FwozenSet[int]

property default_channels[source]

The wist of channyews that wiww be shown to nyew m-m-membews by defauwt.

Type:

Wist[abc.GuildChannel]

OnboawdingPwompt

class disnake.OnboardingPrompt[source]

Wepwesents an onboawding p-p-pwompt.

Nyew i-in vewsion 2.9.

id

The onboawding pwompt’s ID.

Type:

int

type

The onboawding pwompt’s type.

Type:

OnboardingPromptType

options

The onboawding pwompt’s options.

Type:

Wist[OnboardingPromptOption]

title

The onboawding pwompt’s titwe.

Type:

str

single_select

Whethew usews awe wimited to sewecting onye option fow the pwompt.

Type:

bool

required

Whethew the pwompt is wequiwed befowe a usew compwetes the onboawding fwow.

Type:

bool

in_onboarding

Whethew the pwompt is pwesent in the onboawding f-f-fwow. If False, the pwompt wiww onwy appeaw in communyity customization.

Type:

bool

OnboawdingPwomptOption

class disnake.OnboardingPromptOption[source]

Wepwesents a-an onboawding p-p-pwompt option.

Nyew in vewsion 2.9.

id

The pwompt option’s ID.

Type:

int

emoji

The pwompt option’s emoji.

Type:

O-Optionyaw[Unyion[PartialEmoji, Emoji, str]]

title

The pwompt option’s titwe.

Type:

str

description

The pwompt option’s descwiption.

Type:

Optionyaw[str]

role_ids

The IDs of the wowes that wiww be added to the usew when they sewect this option.

Type:

FwozenSet[int]

channel_ids

The IDs of the channyews that the usew wiww see when they s-s-sewect this option.

Type:

FwozenSet[int]

property roles[source]

A wist of wowes that wiww be added to the usew when they sewect this option.

Type:

Wist[Role]

property channels[source]

A wist of channyews t-that the usew w-wiww see when they sewect this option.

Type:

Wist[abc.GuildChannel]

Data Cwasses

SystemChannyewFwags

class disnake.SystemChannelFlags[source]

Wwaps up a Discowd system c-c-channyew fwag vawue.

Simiwaw t-to Permissions, the pwopewties pwovided awe two way. You can set and wetwieve individuaw bits using the pwopewties as if they wewe weguwaw boows. This awwows you to edit the system fwags easiwy.

To constwuct an object you c-can pass keywowd awguments denyoting the fwags to enyabwe ow disabwe. Awguments awe appwied i-i-in owdew, simiwaw to Permissions.

x == y

Checks if two SystemChannyewFwags instances awe equaw.

x != y

Checks if two SystemChannyewFwags instances awe n-nyot equaw.

x <= y

Checks if a SystemChannyewFwags instance is a subset of anyothew SystemChannyewFwags instance.

Nyew i-in vewsion 2.6.

x >= y

Checks if a SystemChannyewFwags instance is a supewset of anyothew SystemChannyewFwags instance.

Nyew in vewsion 2.6.

x < y

Checks if a SystemChannyewFwags instance is a stwict s-subset of a-anyothew SystemChannyewFwags instance.

Nyew in vewsion 2.6.

x > y

Checks if a SystemChannyewFwags instance is a stwict supewset of anyothew SystemChannyewFwags instance.

Nyew in vewsion 2.6.

x | y, x |= y

Wetuwns a nyew SystemChannyewFwags i-i-instance with aww enyabwed fwags fwom both x and y. (Using |= w-w-wiww update in pwace).

Nyew i-i-in vewsion 2.6.

x & y, x &= y

Wetuwns a nyew SystemChannyewFwags instance with onwy fwags enyabwed on both x and y. (Using &= wiww update in pwace).

Nyew in v-v-vewsion 2.6.

x ^ y, x ^= y

Wetuwns a nyew SystemChannyewFwags instance with onwy fwags enyabwed on onye of x ow y, but nyot both. (Using ^= wiww update in pwace).

Nyew in v-vewsion 2.6.

~x

Wetuwns a nyew SystemChannyewFwags instance with aww fwags fwom x invewted.

Nyew in vewsion 2.6.

hash(x)

Wetuwn the fwag’s hash.

iter(x)

Wetuwns an itewatow of (name, value) paiws. This awwows it to be, fow exampwe, constwucted as a dict ow a wist of paiws.

Additionyawwy suppowted awe a few opewations on cwass attwibutes.

SystemChannelFlags.y | SystemChannelFlags.z, SystemChannelFlags(y=True) | SystemChannelFlags.z

Wetuwns a SystemChannyewFwags instance with aww pwovided fwags enyabwed.

~SystemChannelFlags.y

Wetuwns a SystemChannyewFwags instance with aww f-fwags except y invewted f-f-fwom theiw defauwt vawue.

value

T-The waw vawue. This vawue is a bit awway fiewd of a 53-bit integew wepwesenting the cuwwentwy avaiwabwe fwags. You shouwd quewy fwags via the pwopewties wathew than using this waw vawue.

Type:

int

join_notifications

Wetuwns True if the system channyew is used fow membew join nyotifications.

Type:

bool

premium_subscriptions

Wetuwns True if the system channyew is u-used fow “Nyitwo boosting” nyotifications.

Type:

bool

guild_reminder_notifications

Wetuwns True if the system channyew is used fow sewvew setup hewpfuw tips n-nyotifications.

Nyew in vewsion 2.0.

Type:

bool

join_notification_replies

Wetuwns True if the system channyew shows stickew wepwy buttons fow membew join nyotifications.

Nyew in vewsion 2.3.

Type:

bool

role_subscription_purchase_notifications

Wetuwns True if the system channyew shows wowe subscwiption puwchase/wenyewaw nyotifications.

Nyew i-in vewsion 2.9.

Type:

bool

role_subscription_purchase_notification_replies

Wetuwns True if the system channyew s-s-shows stickew wepwy buttons fow wowe subscwiption puwchase/wenyewaw nyotifications.

Nyew in vewsion 2.9.

Type:

bool

WewcomeScweenChannyew

Attwibutes
class disnake.WelcomeScreenChannel[source]

Wepwesents a Discowd wewcome scween channyew.

Nyew in vewsion 2.5.

id

The ID of the g-guiwd channyew this wewcome scween channyew wepwesents.

Type:

int

description

The descwiption of this channyew in the officiaw UI.

Type:

str

emoji

The emoji associated with this channyew’s wewcome message, if any.

Type:

O-Optionyaw[Unyion[Emoji, PartialEmoji]]

GuiwdBuiwdew

class disnake.GuildBuilder[source]

A guiwd buiwdew object, c-cweated by Client.guild_builder().

This awwows fow easiew configuwation o-of mowe compwex g-guiwd setups, abstwacting away some of the quiwks o-of the guiwd cweation endpoint.

Nyew in vewsion 2.8.

Nyote

Many methods of this cwass wetuwn unspecified pwacehowdew IDs (cawwed PlaceholderID bewow) that can be used to wefewence the cweated object in othew objects, fow exampwe w-wefewencing a categowy when cweating a nyew text channyew, ow a wowe w-w-when setting pewmission uvwwwites.

Exampwes

Basic usage:

builder = client.guild_builder("Cat Pics")
builder.add_text_channel("meow", topic="cat.")
guild = await builder.create()

Adding mowe channyews + wowes:

builder = client.guild_builder("More Cat Pics")
builder.add_text_channel("welcome")

# add roles
guests = builder.add_role("guests")
admins = builder.add_role(
    "catmins",
    permissions=Permissions(administrator=True),
    hoist=True,
)

# add cat-egory and text channel
category = builder.add_category("cats!")
meow_channel = builder.add_text_channel(
    "meow",
    topic="cat.",
    category=category,
    overwrites={guests: PermissionOverwrite(send_messages=False)}
)

# set as system channel
builder.system_channel = meow_channel

# add hidden voice channel
builder.add_voice_channel(
    "secret-admin-vc",
    category=category,
    overwrites={builder.everyone: PermissionOverwrite(view_channel=False)}
)

# finally, create the guild
guild = await builder.create()
name

The nyame of the nyew g-g-guiwd.

Type:

str

icon

The icon of the nyew guiwd.

Type:

Optionyaw[U-U-Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]

verification_level

The vewification wevew of the nyew guiwd.

Type:

O-O-Optionyaw[VerificationLevel]

default_notifications

The defauwt nyotification wevew fow the nyew guiwd.

Type:

Optionyaw[NotificationLevel]

explicit_content_filter

The expwicit content fiwtew fow the nyew guiwd.

Type:

Optionyaw[ContentFilter]

afk_channel

The channyew that is used as the AFK c-channyew.

Type:

Optionyaw[PlaceholderID]

afk_timeout

The nyumbew of seconds u-untiw s-someonye is muvd to the AFK channyew.

Type:

Optionyaw[int]

system_channel

The c-c-channyew that is used as the system channyew.

Type:

Optionyaw[PlaceholderID]

system_channel_flags

The settings to use with the system channyew.

Type:

Optionyaw[SystemChannelFlags]

property everyone[source]

The pwacehowdew ID used fow the @everyone wowe.

Type:

PlaceholderID

await create()[source]

This f-f-function is a cowoutinye.

Cweates the configuwed g-guiwd.

Waises:
Wetuwns:

The cweated guiwd. This is n-n-nyot the same guiwd that is added to cache.

Nyote

Due to API wimitations, this wetuwnyed guiwd does nyot contain any of the configuwed channyews.

Wetuwn type:

Guild

update_everyone_role(*, permissions=...)[source]

Updates attwibutes of the @everyone wowe.

Pawametews:

pewmissions (Permissions) – The pewmissions the wowe shouwd have.

Wetuwns:

The pwacehowdew ID fow the @everyone wowe. Awso avaiwabwe as everyone.

Wetuwn type:

PlaceholderID

add_role(name=..., *, permissions=..., color=..., colour=..., hoist=..., mentionable=...)[source]

Adds a wowe to the guiwd buiwdew.

The defauwt (@everyone) wowe can be wefewenced using everyone and configuwed thwough update_everyone_role().

Pawametews:
  • nyame (str) – The wowe n-nyame. Defauwts to ‘nyew wowe’.

  • pewmissions (Permissions) – The pewmissions t-t-the wowe shouwd have. Defauwts to nyo pewmissions.

  • cowouw (Unyion[Colour, int]) – The cowouw fow the wowe. Defauwts to Colour.default(). This is awiased to color as weww.

  • hoist (bool) – Whethew the wowe shouwd be shown sepawatewy in the membew wist. Defauwts to False.

  • mentionyabwe (bool) – Whethew the wowe shouwd be mentionyabwe by othews. Defauwts to False.

W-W-Wetuwns:

A pwacehowdew ID fow the cweated wowe.

Wetuwn type:

PlaceholderID

add_category(name, *, overwrites=...)[source]

Adds a categowy channyew to the guiwd buiwdew.

Thewe is an awias fow this nyamed add_category_channel.

Pawametews:
Wetuwns:

A pwacehowdew ID fow t-the cweated categowy.

Wetuwn type:

PlaceholderID

add_text_channel(name, *, overwrites=..., category=..., topic=..., slowmode_delay=..., nsfw=..., default_auto_archive_duration=...)[source]

Adds a text channyew to the guiwd buiwdew.

Pawametews:
  • nyame (str) – The channyew’s nyame.

  • uvwwwites (Dict[PlaceholderID, PermissionOverwrite]) – A dict of wowes t-to PermissionOverwrites t-to a-a-appwy to the channyew.

  • categowy (PlaceholderID) –

    The categowy to pwace the nyew channyew u-undew.

    Wawnying

    Unwike Guild.create_text_channel(), the pawent categowy’s pewmissions wiww nyot be synced to this nyew channyew by defauwt.

  • topic (Optionyaw[str]) – The channyew’s topic.

  • swowmode_deway (int) – Specifies the swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes s-swowmode. The maximum vawue possibwe is 21600. If nyot pwovided, swowmode is disabwed.

  • nsfw (bool) – Whethew to mawk the channyew as NSFW.

  • defauwt_auto_awchive_duwation (Unyion[int, ThreadArchiveDuration]) – The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew. Must be o-onye of 60, 1440, 4320, ow 10080.

Wetuwns:

A pwacehowdew I-I-ID fow the cweated text channyew.

Wetuwn type:

PlaceholderID

add_voice_channel(name, *, overwrites=..., category=..., slowmode_delay=..., nsfw=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=...)[source]

Adds a voice channyew to the guiwd buiwdew.

Pawametews:
  • nyame (str) – The channyew’s nyame.

  • uvwwwites (Dict[PlaceholderID, PermissionOverwrite]) – A dict of wowes to PermissionOverwrites to appwy to the channyew.

  • categowy (PlaceholderID) –

    The categowy to pwace the nyew channyew undew.

    Wawnying

    Unwike Guild.create_voice_channel(), t-t-the pawent categowy’s pewmissions wiww nyot be synced to this nyew channyew by defauwt.

  • swowmode_deway (int) – Specifies the swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue p-p-possibwe is 21600. If nyot pwovided, swowmode is disabwed.

  • nsfw (bool) – Whethew to mawk the channyew a-a-as NSFW.

  • bitwate (int) – The channyew’s p-p-pwefewwed audio bitwate in bits pew second.

  • usew_wimit (int) – The channyew’s wimit fow nyumbew of membews that can be in a voice channyew.

  • w-wtc_wegion (Optionyaw[Unyion[str, VoiceRegion]]) – The w-wegion fow the voice channyew’s voice communyication. A vawue of None indicates automatic voice wegion detection.

  • video_quawity_mode (VideoQualityMode) – The camewa video quawity fow the voice channyew’s pawticipants.

Wetuwns:

A pwacehowdew ID fow the c-c-cweated voice channyew.

Wetuwn type:

PlaceholderID

Enyumewations

VewificationWevew

class disnake.VerificationLevel[source]

Specifies a Guild's vewification wevew, which is the cwitewia in which a membew must meet befowe being abwe to send messages to the guiwd.

Nyew in vewsion 2.0.

x == y

Checks if two vewification wevews awe equaw.

x != y

Checks if two vewification wevews awe nyot equaw.

x > y

Checks if a-a vewification w-w-wevew is highew than anyothew.

x < y

Checks if a vewification wevew is wowew than anyothew.

x >= y

Checks if a vewification wevew is highew ow equaw to anyothew.

x <= y

C-C-Checks if a vewification wevew is wowew o-ow equaw to anyothew.

none

N-N-Nyo cwitewia set.

low

Membew must have a vewified emaiw on theiw Discowd account.

medium

Membew must have a vewified emaiw and be wegistewed on Discowd fow mowe than five minyutes.

high

Membew must have a vewified emaiw, b-b-be wegistewed on Discowd fow mowe than five minyutes, and be a membew of the guiwd itsewf fow mowe than ten minyutes.

highest

Membew must have a vewified phonye on theiw Discowd account.

NyotificationWevew

class disnake.NotificationLevel[source]

Specifies w-w-whethew a Guild has nyotifications on fow aww messages ow mentions onwy by d-defauwt.

x == y

Checks if two nyotification wevews awe equaw.

x != y

Checks if two nyotification wevews awe nyot equaw.

x > y

Checks if a n-nyotification wevew is highew than anyothew.

x < y

Checks if a nyotification wevew is wowew than anyothew.

x >= y

Checks if a nyotification wevew is highew ow equaw to anyothew.

x <= y

Checks if a nyotification wevew is wowew ow equaw to anyothew.

all_messages

Membews weceive nyotifications fow evewy message wegawdwess of them b-b-being mentionyed.

only_mentions

Membews weceive nyotifications fow messages they awe mentionyed in.

ContentFiwtew

class disnake.ContentFilter[source]

Specifies a Guild's expwicit content fiwtew, which is the machinye weawnying awgowithms that Discowd uses to detect if an image contains NSFW content.

x == y

Checks if two content fiwtew wevews awe equaw.

x != y

Checks if two content fiwtew wevews awe nyot equaw.

x > y

Checks if a c-content fiwtew wevew is highew than anyothew.

x < y

Checks if a content fiwtew wevew is wowew than anyothew.

x >= y

Checks if a c-content fiwtew w-wevew is highew ow equaw to anyothew.

x <= y

Checks if a content f-f-fiwtew wevew is wowew ow equaw to anyothew.

disabled

The guiwd does nyot have the content fiwtew enyabwed.

no_role

The guiwd has the content fiwtew enyabwed fow membews without a wowe.

all_members

The guiwd has the content fiwtew enyabwed fow evewy membew.

NSFWWevew

class disnake.NSFWLevel[source]

Wepwesents the NSFW wevew of a guiwd.

Nyew in vewsion 2.0.

x == y

Checks if two NSFW wevews awe equaw.

x != y

Checks if two NSFW wevews awe nyot e-equaw.

x > y

Checks if an NSFW wevew is highew than anyothew.

x < y

Checks if an NSFW wevew i-i-is wowew than anyothew.

x >= y

Checks i-if an NSFW wevew is highew ow equaw to anyothew.

x <= y

Checks if an NSFW wevew is wowew ow equaw to anyothew.

default

The guiwd has n-nyot been categowised yet.

explicit

The guiwd contains NSFW content.

safe

The guiwd does n-nyot contain any NSFW content.

age_restricted

The guiwd may contain NSFW content.

OnboawdingPwomptType

class disnake.OnboardingPromptType[source]

Wepwesents the type of onboawding pwompt.

Nyew in vewsion 2.9.

multiple_choice

The pwompt is a muwtipwe choice pwompt.

dropdown

The pwompt is a dwopdown pwompt.

Events