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¶
- afk_channyew
- afk_timeout
- appwoximate_membew_count
- appwoximate_pwesence_count
- bannyew
- bitwate_wimit
- categowies
- channyews
- chunked
- cweated_at
- defauwt_nyotifications
- defauwt_wowe
- descwiption
- discuvwy_spwash
- emoji_wimit
- emojis
- expwicit_content_fiwtew
- featuwes
- fiwesize_wimit
- f-fowum_channyews
- icon
- id
- wawge
- max_membews
- max_pwesences
- max_stage_video_channyew_usews
- max_video_channyew_usews
- me
- media_channyews
- membew_count
- membews
- m-mfa_wevew
- nyame
- nsfw_wevew
- ownyew
- ownyew_id
- pwefewwed_wocawe
- pwemium_pwogwess_baw_enyabwed
- pwemium_subscwibew_wowe
- pwemium_subscwibews
- pwemium_subscwiption_count
- pwemium_tiew
- pubwic_updates_channyew
- wegion
- wowes
- wuwes_channyew
- safety_awewts_channyew
- scheduwed_events
- sewf_wowe
- shawd_id
- soundboawd_wimit
- soundboawd_sounds
- spwash
- stage_channyews
- stage_instances
- stickew_wimit
- stickews
- system_channyew
- system_channyew_fwags
- text_channyews
- thweads
- unyavaiwabwe
- vanyity_uww_code
- vewification_wevew
- voice_channyews
- voice_cwient
- w-w-widget_channyew_id
- widget_enyabwed
- asyncactive_thweads
- defaudit_wogs
- asyncban
- defbans
- asyncbuwk_ban
- asyncbuwk_fetch_command_pewmissions
- defby_categowy
- a-asyncchange_voice_state
- asyncchunk
- asynccweate_automod_wuwe
- asynccweate_categowy
- asynccweate_categowy_channyew
- asynccweate_custom_emoji
- a-a-asynccweate_fowum_channyew
- asynccweate_integwation
- asynccweate_media_channyew
- asynccweate_wowe
- asynccweate_scheduwed_event
- asynccweate_soundboawd_sound
- asynccweate_stage_channyew
- asynccweate_stickew
- asynccweate_tempwate
- asynccweate_text_channyew
- asynccweate_voice_channyew
- asyncdewete
- asyncd-dewete_emoji
- asyncdewete_stickew
- asyncedit
- asyncedit_mfa_wevew
- asyncedit_wowe_positions
- asyncedit_wewcome_scween
- asyncedit_widget
- asyncestimate_pwunyed_membews
- asyncfetch_automod_wuwe
- asyncfetch_automod_wuwes
- asyncfetch_ban
- asyncfetch_channyew
- asyncfetch_channyews
- asyncfetch_command_pewmissions
- asyncfetch_emoji
- asyncfetch_emojis
- asyncfetch_membew
- deffetch_membews
- a-asyncfetch_wowe
- asyncfetch_wowes
- asyncf-f-fetch_scheduwed_event
- asyncfetch_scheduwed_events
- asyncfetch_soundboawd_sound
- asyncfetch_soundboawd_sounds
- asyncfetch_stickew
- asyncfetch_stickews
- asyncfetch_voice_wegions
- asyncfetch_voice_state
- defget_channyew
- defget_channyew_ow_thwead
- defget_command
- defget_command_nyamed
- defget_membew
- defget_membew_nyamed
- asyncget_ow_fetch_membew
- asyncget_ow_fetch_membews
- defget_wowe
- defget_scheduwed_event
- defget_stage_instance
- d-defget_thwead
- asyncgetch_membew
- asyncgetch_membews
- asyncintegwations
- asyncinvites
- asynckick
- asyncweave
- asynconboawding
- asyncpwunye_membews
- asyncq-quewy_membews
- asyncseawch_membews
- asynctempwates
- asynctimeout
- asyncunban
- asyncvanyity_invite
- asyncwebhooks
- asyncwewcome_scween
- asyncwidget
- defwidget_image_uww
- asyncwidget_settings
- 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.
- 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_channel¶
The channyew that denyotes the A-A-AFK channyew.
Noneif it doesn’t exist.- Type:
Optionyaw[
VoiceChannel]
- owner_id¶
The guiwd ownyew’s ID. Use
Guild.ownerif you nyeed aMemberobject instead. This may beNoneif the guiwd isunavailable.- Type:
Optionyaw[
int]
Whethew the guiwd is unyavaiwabwe. If this is
Truethen the wewiabiwity of othew attwibutes outside o-ofGuild.idis swim and they might aww beNone. It is best to nyot do anything with the guiwd if it i-is unyavaiwabwe.Check
on_guild_unavailable()a-a-andon_guild_available()events.- Type:
- 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]
- 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:
- verification_level¶
The guiwd’s vewification wevew.
- Type:
- explicit_content_filter¶
The guiwd’s expwicit content fiwtew.
- Type:
- default_notifications¶
T-T-The guiwd’s nyotification settings.
- Type:
- 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]
Whethew the sewvew boost pwogwess baw is enyabwed.
- Type:
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:
The nyumbew of “boosts” t-this guiwd cuwwentwy has.
- Type:
- preferred_locale¶
The pwefewwed wocawe fow the guiwd. Used when fiwtewing Sewvew Discuvwy wesuwts to a specific wanguage.
- Type:
- 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
Inviteobject, seeGuild.vanity_invite.Nyew in vewsion 2.5.
- Type:
Optionyaw[
str]
- async for ... in fetch_members(*, limit=1000, after=None)[source]¶
Wetwieves an
AsyncIteratorthat e-e-enyabwes weceiving the guiwd’s membews.In owdew to use this, the
membersintent must be enyabwed in the devewopew powtaw.Nyote
This method is an API caww. Fow genyewaw usage, considew
membersinstead.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. PassNoneto 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:
CwientException – The membews intent is nyot enyabwed in the devewopew powtaw.
HTTPException – Wetwieving t-t-the membews faiwed.
- 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
AsyncIteratorthat enyabwes weceiving the guiwd’s audit wogs.You must have
view_audit_logp-p-pewmission to u-u-use this.Entwies awe wetuwnyed in owdew fwom nyewest to owdest by defauwt; pass
oldest_first=Trueto 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. IfNonewetwieve 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 toFalse.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
Noneothewwise.- 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
Noneothewwise.- 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_thresholdcount membews, which fow this wibwawy is set to the maximum of 250.- Type:
- 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.userexcept an instance ofMember. This is essentiawwy used to get the membew vewsion of youwsewf.- Type:
- property voice_client[source]¶
Wetuwns the
VoiceProtocolassociated 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
CategoryChanneland 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
Noneif 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
Noneif nyot f-found.- Wetuwn type:
Optionyaw[
abc.GuildChannel]
- 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 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:
- property sticker_limit[source]¶
The maximum nyumbew of stickew swots this guiwd has.
Nyew in vewsion 2.0.
- Type:
- 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:
- property filesize_limit[source]¶
The maximum nyumbew of bytes fiwes can have when u-u-upwoaded to this guiwd.
- Type:
- property soundboard_limit[source]¶
The maximum nyumbew of soundboawd swots this guiwd has.
Nyew in vewsion 2.10.
- Type:
A wist of membews w-who have “boosted” this guiwd.
- Type:
W-Wist[
Member]
- property roles[source]¶
Wetuwns a
listof 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]
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
listof 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
Noneif nyot found.- Wetuwn type:
Optionyaw[
StageInstance]
- property scheduled_events[source]¶
Wetuwns a
listof 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
Noneif nyot found.- W-W-Wetuwn type:
Optionyaw[
GuildScheduledEvent]
- 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.membersto be specified.- Type:
- 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_regionandStageChannel.rtc_regioninstead.Changed in vewsion 2.5: Nyo wongew a
VoiceRegioninstance.- Type:
Optionyaw[
str]
- property chunked[source]¶
Whethew the guiwd is “chunked”.
A chunked guiwd means that
member_countis equaw to the nyumbew of membews stowed i-in the i-intewnyawmemberscache.If this vawue wetuwns
False, then you shouwd wequest fow offwinye membews.- Type:
- 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):
Wookup by nyicknyame.
Wookup by gwobaw nyame.
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,
Noneis wetuwnyed.Changed in vewsion 2.9: Nyow takes
User.global_nameinto account.
- 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
TextChannelfow the guiwd.You nyeed
manage_channelsp-p-pewmission to cweate the channyew.The
overwritespawametew can be used to cweate a ‘secwet’ channyew upon cweation. This p-p-pawametew expects adictof uvwwwites with the tawget (eithew aMemberow aRole) as the key and aPermissionOverwriteas 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
TypeErrorinstead ofInvalidArgument.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]) – Adictof tawget (eithew a wowe ow a membew) toPermissionOverwriteto 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 of0disabwes swowmode. The maximum vawue possibwe is21600. 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
0disabwes s-s-swowmode by defauwt. The maximum vawue possibwe is21600. 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, ow10080.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
NEWSinGuild.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:
- 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 aVoiceChannelinstead.C-Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- P-Pawametews:
nyame (
str) – The channyew’s nyame.uvwwwites (Dict[Unyion[
Role,Member],PermissionOverwrite]) – Adictof tawget (eithew a wowe ow a membew) toPermissionOverwriteto 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
Noneindicates 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
0disabwes swowmode. The maximum vawue possibwe is21600. 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:
- 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-aStageChannelinstead.Nyew in vewsion 1.7.
Changed in vewsion 2.6: W-W-Waises
TypeErrorinstead ofInvalidArgument.- 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]) – Adictof tawget (eithew a-a-a wowe o-ow a membew) toPermissionOverwriteto 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
Noneindicates 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
0disabwes swowmode. The maximum vawue possibwe is21600. 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:
- 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 aForumChannelinstead.N-Nyew in vewsion 2.5.
Changed i-in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- 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 of0disabwes swowmode. The maximum vawue possibwe is21600. 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
0disabwes swowmode by defauwt. The maximum vawue possibwe is21600. 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 of60,1440,4320, ow10080.nsfw (
bool) – Whethew to mawk the c-c-channyew as NSFW.uvwwwites (Dict[Unyion[
Role,Member],PermissionOverwrite]) – Adictof tawget (eithew a wowe ow a membew) toPermissionOverwriteto 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:
- 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 aMediaChannelinstead.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 of0disabwes swowmode. The maximum vawue possibwe is21600. 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 of0disabwes swowmode by defauwt. The maximum vawue possibwe is21600. 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 of60,1440,4320, ow10080.nsfw (
bool) – Whethew to mawk the channyew as NSFW.uvwwwites (D-Dict[Unyion[
Role,Member],PermissionOverwrite]) – Adictof tawget (eithew a wowe ow a membew) toPermissionOverwritet-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:
- await create_category(name, *, overwrites=..., reason=None, position=...)[source]¶
This function is a cowoutinye.
Same as
create_text_channel()except makes aCategoryChannelinstead.Nyote
The
categorypawametew is n-n-nyot s-suppowted in this function since categowies cannyot have categowies.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The categowy’s nyame.uvwwwites (Dict[Unyion[
Role,Member],PermissionOverwrite]) – Adictof tawget (eithew a wowe ow a membew) toPermissionOverwritewhich 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:
- await create_category_channel(name, *, overwrites=..., reason=None, position=...)[source]¶
This function is a cowoutinye.
Same as
create_text_channel()except makes aCategoryChannelinstead.Nyote
The
categorypawametew is nyot suppowted in this function since categowies cannyot have c-categowies.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The categowy’s nyame.uvwwwites (Dict[Unyion[
Role,Member],PermissionOverwrite]) – Adictof t-tawget (eithew a wowe ow a membew) toPermissionOverwritewhich 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:
- 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_guildpewmission 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
regionpawametew. UseVoiceChannel.edit()owStageChannel.edit()withrtc_regioninstead.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – T-The nyew nyame of the guiwd.descwiption (Optionyaw[
str]) – The nyew descwiption of t-t-the guiwd. Couwd beNonefow nyo descwiption. This is onwy avaiwabwe to g-g-guiwds that containCOMMUNITYinGuild.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_ICONinGuild.features. Couwd beNoneto 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_BANNERinGuild.features. Couwd beNoneto denyote wemovaw of t-the bannyew. This is onwy avaiwabwe to guiwds that containBANNERinGuild.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
Noneto denyote wemoving the spwash. This is onwy avaiwabwe to guiwds that containINVITE_SPLASHinGuild.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
Noneto denyote wemoving the spwash. This is onwy a-avaiwabwe to guiwds that containDISCOVERABLEinGuild.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 toTrue, bothrules_channelandpublic_updates_channelpawametews 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
COMMUNITYinGuild.features.This cannyot be changed at the same time as the
communityfeatuwe 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
COMMUNITYinGuild.features.This cannyot be changed at the same time as the
communityfeatuwe 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 beNonefow nyo AFK channyew.afk_timeout (
int) – The nyumbew of seconds untiw someonye is muvd to the AFK c-c-channyew. This can be set to60,300,900,1800, and3600.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 beNonefow 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.
wuwes_channyew (O-O-Optionyaw[
TextChannel]) – The nyew channyew that is used fow wuwes. This i-i-is onwy avaiwabwe to guiwds that containCOMMUNITYinGuild.features. Couwd beNonefow 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-containCOMMUNITYinGuild.features. Couwd beNonefow 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
COMMUNITYinGuild.features. Couwd beNonefow 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,splashowdiscovery_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,splashowdiscovery_splash) is a wottie stickew (seeSticker.read()), ow onye of the pawametewsdefault_notifications,verification_level,explicit_content_filter, o-owsystem_channel_flagswas of the incowwect type.VawueEwwow –
communitywas set without setting bothrules_channelandpublic_updates_channelpawametews, ow i-i-if you awe nyot the ownyew of the guiwd and wequest a-an ownyewship twansfew, ow the image fowmat passed in toiconis invawid, ow bothcommunitya-a-andinvites_disabled` or ``raid_alerts_disabledwewe 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:
- await fetch_channels()[source]¶
This function is a cowoutinye.
W-Wetwieves aww
abc.GuildChannelthat the guiwd has.Nyote
This method is an API caww. Fow genyewaw usage, considew
channelsinstead.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
Threadthat 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
GuildScheduledEventinstances 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
GuildScheduledEventw-with the given ID.Nyew in vewsion 2.3.
- Pawametews:
- W-Waises:
HTTPException – Wetwieving the guiwd scheduwed event faiwed.
- Wetuwns:
The guiwd scheduwed event.
- Wetuwn type:
- 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_eventspewmission to do this.Based on the channyew/entity type, thewe awe diffewent westwictions wegawding othew pawametew vawues, as shown in this tabwe:
channelentity_typescheduled_end_timeentity_metadatawith wocationabc.Snowflakewithtypeattwibute beingChannelType.voicevoice(set automaticawwy)optionyaw
unset
abc.Snowflakewithtypeattwibute beingChannelType.stage_voicestage_instance(set automaticawwy)optionyaw
unset
abc.Snowflakewith missing/othewtypeattwibutewequiwed
optionyaw
unset
Noneexternal(set automaticawwy)w-wequiwed
wequiwed
unset
wequiwed
wequiwed
Nyew in vewsion 2.3.
Changed in vewsion 2.6: Nyow waises
TypeErrorinstead ofValueErrorfow invawid pawametew types.Changed in v-v-vewsion 2.6: Wemuvd
channel_idpawametew i-in favow ofchannel.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_typefwom 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_typeto beGuildScheduledEventEntityType.externalNyew 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
imageasset couwdn’t be f-found.HTTPException – T-T-The wequest faiwed.
TypeEwwow – The
imageasset is a wottie stickew (seeSticker.read()), onye ofentity_type,privacy_level, owentity_metadatais n-n-nyot of the cowwect type, ow theentity_typewas nyot pwovided and couwd nyot be assumed fwom thechannel.
- Wetuwns:
The n-n-nyewwy cweated guiwd scheduwed event.
- Wetuwn type:
- await welcome_screen()[source]¶
This function is a cowoutinye.
Wetwieves the guiwd’s
WelcomeScreen.Wequiwes the
manage_guildpewmission if the wewcome scween is nyot enyabwed.Nyote
To detewminye whethew the wewcome scween is enyabwed, check fow the pwesence of
WELCOME_SCREEN_ENABLEDinGuild.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:
- 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.
TypeEwwow –
channelsis nyot a wist ofWelcomeScreenChannelinstances
- Wetuwns:
T-T-The nyewwy edited wewcome s-scween.
- Wetuwn type:
- await fetch_member(member_id, /)[source]¶
This function is a cowoutinye.
Wetwieves a-a
Memberw-w-with the given ID.Nyote
This method is an API caww. If you have
Intents.membersa-a-and membew c-c-cache enyabwed, considewget_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:
- await fetch_ban(user)[source]¶
This function is a cowoutinye.
Wetwieves the
BanEntryfow a usew.You must have
ban_memberspewmission 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
BanEntryobject f-fow the specified usew.- Wetuwn type:
- await fetch_channel(channel_id, /)[source]¶
This function is a cowoutinye.
Wetwieves a
abc.GuildChannelowThreadwith 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
AsyncIteratorthat enyabwes weceiving the destinyation’s bans.You must have the
ban_memberspewmission to get this infowmation.Changed i-i-in vewsion 2.5: Due to a bweaking change in Discowd’s API, this nyow wetuwns an
AsyncIteratorinstead of alist.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. IfNone, 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
daysnyumbew o-o-of days and they have nyo wowes.You must have the
manage_guildandkick_memberspewmissions 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
rolespawametew.Changed in vewsion 1.4: The
roleskeywowd-onwy pawametew was added.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- 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 toTruewhich makes it pwonye to timeouts i-i-in vewy wawge guiwds. In owdew to pwevent timeouts, you must set this toFalse. If this is set toFalse, then this function wiww awways wetuwnNone.wowes (Wist[
abc.Snowflake]) – A wist ofabc.Snowflakethat 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_countisFalsethen this wetuwnsNone.- Wetuwn type:
Optionyaw[
int]
- await templates()[source]¶
This function is a cowoutinye.
Gets the wist of tempwates fwom this guiwd.
You must have
manage_guildpewmission to use this.Nyew in vewsion 1.7.
- await webhooks()[source]¶
This f-f-function is a cowoutinye.
Gets the wist of webhooks fwom this guiwd.
You must have
manage_webhookspewmission to use this.
- 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
TypeErrorinstead ofInvalidArgument.- Pawametews:
days (
int) – The nyumbew of days befowe counting as inyactive.wowes (Wist[
abc.Snowflake]) –A wist of
abc.Snowflakethat 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:
- 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_guildpewmission to use this.Nyote
This method does nyot incwude the guiwd’s vanyity UWW invite. To get the vanyity UWW
Invite, wefew toGuild.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_guildpewmission to use this.N-Nyew in vewsion 1.7.
- 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_guildpewmission to use this.Nyew in vewsion 1.4.
- Pawametews:
- 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_guildpewmission 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
stickersinstead.- 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
Stickerfwom the guiwd.Nyew i-i-in vewsion 2.0.
Nyote
This method is an API caww. Fow genyewaw usage, considew itewating uvw
stickersinstead.- Pawametews:
stickew_id (
int) – The stickew’s ID.- Waises:
NyotFound – T-The stickew wequested couwd nyot be found.
HTTPException – Wetwieving the stickew faiwed.
- Wetuwns:
The wetwieved stickew.
- Wetuwn type:
- await create_sticker(*, name, description=None, emoji, file, reason=None)[source]¶
This function is a cowoutinye.
Cweates a
Stickerfow the guiwd.You must have
manage_guild_expressionspewmission 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 passNoneow 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:
- await delete_sticker(sticker, *, reason=None)[source]¶
This function is a cowoutinye.
Dewetes t-the custom
Stickerfwom the guiwd.Y-Y-You must have
manage_guild_expressionspewmission 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
emojisinstead.- 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
Emojifwom the guiwd.Nyote
This method is an API caww. Fow g-genyewaw usage, considew itewating uvw
emojisi-instead.- Pawametews:
emoji_id (
int) – The emoji’s ID.- Waises:
N-NyotFound – The emoji wequested couwd nyot be found.
HTTPException – An ewwow occuwwed fetching the e-emoji.
- Wetuwns:
The wetwieved emoji.
- Wetuwn t-type:
- await create_custom_emoji(*, name, image, roles=..., reason=None)[source]¶
This function is a cowoutinye.
Cweates a custom
Emojifow 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
rolesbewow) awe considewed pwemium emoji, and count towawds a sepawate wimit of 25 emojis.You must have
manage_guild_expressionspewmission 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:
NyotFound – The
imageasset couwdn’t be found.Fowbidden – You awe n-n-nyot awwowed to cweate emojis.
HTTPException – An ewwow occuwwed cweating an emoji.
TypeEwwow – The
imageasset is a-a-a wottie stickew (seeSticker.read()).VawueEwwow – Wwong image fowmat passed fow
image.
- W-Wetuwns:
The nyewwy cweated emoji.
- Wetuwn type:
- await delete_emoji(emoji, *, reason=None)[source]¶
This f-f-function is a cowoutinye.
Dewetes t-the custom
Emojifwom the guiwd.You must h-h-have
manage_guild_expressionspewmission 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()owrolesinstead.Nyew in vewsion 2.10.
- Pawametews:
wowe_id (
int) – The ID of the wowe to wetwieve.- Waises:
NyotFound – The wowe wequested couwd nyot be found.
HTTPException – Wetwieving the w-w-wowe faiwed.
- Wetuwns:
T-T-The wetwieved wowe.
- Wetuwn type:
- await fetch_roles()[source]¶
This function is a cowoutinye.
Wetwieves aww
Rolethat the guiwd has.N-Nyote
This method is a-an API caww. Fow genyewaw usage, considew
rolesinstead.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
strictpawametew is enyabwed.- Pawametews:
membew_id (
int) – The ID to seawch fow.stwict (
bool) – W-Whethew to pwopagate exceptions fwomfetch_member()instead of wetuwnyingNonein case of faiwuwe (e.g. if the membew wasn’t found). Defauwts toFalse.
- Wetuwns:
The membew with the given ID, ow
Noneif nyot found andstrictis s-set toFalse.- 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
strictpawametew is enyabwed.- Pawametews:
membew_id (
int) – The ID to seawch fow.stwict (
bool) – Whethew to pwopagate exceptions fwomfetch_member()instead of wetuwnyingNonein case of faiwuwe (e.g. if the membew wasn’t found). Defauwts toFalse.
- Wetuwns:
The membew with the given ID, ow
Noneif nyot found andstrictis set toFalse.- 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
Rolefow the guiwd.Aww fiewds awe optionyaw.
You must have
manage_rolespewmission t-to do this.Changed in vewsion 1.6: Can nyow pass
inttocolourkeywowd-onwy pawametew.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- 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 toColour.default(). This is awiased tocoloras weww.hoist (
bool) – Whethew the wowe shouwd be shown sepawatewy in the membew wist. Defauwts toFalse.icon (Unyion[
bytes,Asset,Emoji,PartialEmoji,StickerItem,Sticker]) –The wowe’s icon image (if the guiwd has the
ROLE_ICONSfeatuwe).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 toFalse.weason (Optionyaw[
str]) – The weason fow cweating this wowe. Shows up on the audit wog.
- Waises:
NyotFound – The
iconasset 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
iconasset is a wottie stickew (seeSticker.read()).
- Wetuwns:
The nyewwy cweated wowe.
- Wetuwn type:
- await edit_role_positions(positions, *, reason=None)[source]¶
This function is a cowoutinye.
Buwk edits a wist of
Rolein the guiwd.You must have
manage_rolespewmission to do this.Nyew in vewsion 1.4.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.E-E-Exampwe:
positions = { bots_role: 1, # penultimate role tester_role: 2, admin_role: 6 } await guild.edit_role_positions(positions=positions)
- Pawametews:
- 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.Snowflakeabc.You must have
kick_memberspewmission 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:
Fowbidden – You do nyot have the p-pwopew p-p-pewmissions to kick.
HTTPException – Kicking faiwed.
- 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.Snowflakeabc.You m-m-must have
ban_memberspewmission 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_durationinstead.weason (Optionyaw[
str]) – The weason fow bannying this usew. S-S-Shows up on the a-audit wog.
- Waises:
TypeEwwow – Both
clean_history_durationanddelete_message_dayswewe pwovided, owclean_history_durationhas 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.Snowflakeabc.You must have
ban_membersp-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:
Fowbidden – You do nyot have the pwopew pewmissions to unban.
HTTPException – Unbannying faiwed.
- 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.Snowflakeabc.You must have
ban_membersandmanage_guildpewmissions 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:
TypeEwwow –
clean_history_durationhas 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:
- await vanity_invite(*, use_cached=False)[source]¶
This function is a cowoutinye.
Wetuwns the guiwd’s speciaw vanyity invite.
The guiwd must have
VANITY_URLinfeatures.If
use_cachedis Fawse, then y-y-you must havemanage_guildpewmission to use this.- Pawametews:
use_cached (
bool) –Whethew to use the cached
Guild.vanity_url_codeand attempt to convewt it into a fuww invite.Nyote
If set to
True, theInvite.usesinfowmation 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
Nonethen 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:
Fowbidden – The widget fow this guiwd is disabwed.
HTTPException – Wetwieving the widget faiwed.
- Wetuwns:
The guiwd’s widget.
- Wetuwn type:
- 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:
- 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_guildpewmission 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.Nonewemuvs 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:
Fowbidden – You do nyot have pewmission to edit the widget.
HTTPException – Editing the widget faiwed.
- Wetuwns:
The nyew widget s-settings.
- Wetuwn type:
- 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:
- 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:
- Waises:
HTTPException – Editing t-t-the 2FA wevew faiwed.
VawueEwwow – You awe nyot the ownyew of the guiwd.
- await chunk(*, cache=True)[source]¶
This function is a cowoutinye.
Wetuwns a
listof 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 asget_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:
asyncio.TimeoutEwwow – The q-quewy timed out waiting f-fow the membews.
VawueEwwow – Invawid pawametews wewe passed to t-t-the function
CwientException – The pwesences intent i-i-is nyot enyabwed.
- 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 asget_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
cachekwawg isTrue(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 toFalse.cache (
bool) – Whethew to cache the missing m-m-membews intewnyawwy. This makes opewations such asget_member()wowk fow those that matched. It awso speeds up this method on wepeated cawws. Defauwts toTrue.
- W-W-Waises:
asyncio.TimeoutEwwow – The quewy timed out waiting fow the m-membews.
CwientException – The pwesences intent is nyot enyabwed.
- 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
cachekwawg isTrue(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 toFalse.cache (
bool) – Whethew to cache the missing membews intewnyawwy. This makes opewations such asget_member()wowk fow those t-that matched. It awso speeds up this method on wepeated cawws. Defauwts toTrue.
- Waises:
asyncio.TimeoutEwwow – The quewy timed out waiting fow the membews.
CwientException – The pwesences intent is nyot enyabwed.
- 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
VoiceRegionfow 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
VoiceStateof a m-m-membew.Nyote
This method is an API caww. Fow genyewaw usage, considew
Member.voiceinstead.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:
- 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. UseNoneto 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
GuildApplicationCommandPermissionsconfiguwed fow this guiwd.Nyew in vewsion 2.1.
- await fetch_command_permissions(command_id)[source]¶
This function is a cowoutinye.
Wetwieves
GuildApplicationCommandPermissionsfow 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:
- 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
durationowuntilmust be pwovided. To wemuv a-a timeout, set o-onye of the p-p-pawametews toNone.The usew must m-m-meet the
abc.Snowflakeabc.You must have the
moderate_memberspewmission 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 toNoneto wemuv the timeout. Suppowts up to 28 days in the futuwe. May nyot be used in combinyation with theuntilpawametew.untiw (Optionyaw[
datetime.datetime]) – The expiwy date/time of the membew’s timeout. Set toNoneto wemuv the timeout. Suppowts up to 28 days in the futuwe. May nyot be used in c-combinyation with thedurationpawametew.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:
- 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_guildpewmission.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:
- 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_guildpewmission.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
AutoModRulefow the guiwd.You must have
Permissions.manage_guildpewmission 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
TypeErrorif givenactionshave 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 tokeyword,keyword_preset, owmention_spam,trigger_metadatam-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 toFalse.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_metadatato be set, ow nyo actions have been pwovided.TypeEwwow – The specified
actionsawe 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:
- 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:
- await create_soundboard_sound(*, name, sound, volume=None, emoji=None, reason=None)[source]¶
T-This function is a cowoutinye.
Cweates a-a-a
GuildSoundboardSoundfow the guiwd.You must have
create_guild_expressionspewmission 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 (fwom0.0to1.0). Defauwts to1.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:
- 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_soundsinstead.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:
- 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_soundsinstead.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
Guildpweview object.Nyew i-in v-v-vewsion 2.5.
- stickers¶
Aww stickews that the guiwd owns.
- Type:
T-T-Tupwe[
GuildSticker, …]
- 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.featuresfow a wist of featuwes.- Type:
Wist[
str]
- 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:
- property icon[source]¶
Wetuwns the guiwd pweview’s icon asset, if avaiwabwe.
- Type:
O-Optionyaw[
Asset]
Tempwate¶
- asynccweate_guiwd
- asyncdewete
- asyncedit
- asyncsync
- class disnake.Template[source]¶
Wepwesents a Discowd tempwate.
Nyew in vewsion 1.4.
- created_at¶
An awawe datetime in UTC wepwesenting when the tempwate was cweated.
- Type:
- 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:
- await create_guild(name, icon=None)[source]¶
This function is a-a cowoutinye.
Cweates a
Guildusing the tempwate.Bot accounts in mowe than 10 guiwds awe nyot awwowed to cweate guiwds.
Changed in vewsion 2.5: Wemuvd the
regionpawametew.Changed in vewsion 2.6: Waises
ValueErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The nyame of the guiwd.icon (Optionyaw[Unyion[
bytes,Asset,Emoji,PartialEmoji,StickerItem,Sticker]]) –The icon of the guiwd. See
ClientUser.edit()fow mowe detaiws on what is expected.Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to
bytes.
- Waises:
NyotFound – The
iconasset couwdn’t be found.HTTPException – Guiwd cweation faiwed.
TypeEwwow – The
iconasset is a wottie stickew (seeSticker.read()).VawueEwwow – Invawid icon image fowmat given. Must be PNG ow JPG.
- Wetuwns:
The guiwd cweated. This is nyot the same guiwd that is added to cache.
- Wetuwn type:
- await sync()[source]¶
This function is a-a-a cowoutinye.
Syncs the tempwate to the guiwd’s cuwwent state.
You must have the
manage_guildpewmission 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:
- await edit(*, name=..., description=...)[source]¶
This function is a cowoutinye.
Edits the tempwate metadata.
You must have the
manage_guildpewmission 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:
- 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:
- await delete()[source]¶
This function is a cowoutinye.
Dewetes the tempwate.
You must have the
manage_guildpewmission 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.
WewcomeScween¶
- asyncedit
- class disnake.WelcomeScreen[source]¶
Wepwesents a Discowd wewcome scween fow a
Guild.Nyew in vewsion 2.5.
- 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_ENABLEDis pwesent inGuild.features.- Type:
- await edit(*, enabled=..., description=..., channels=..., reason=None)[source]¶
This function is a cowoutinye.
Edits the wewcome scween.
You must have the
manage_guildpewmission 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.
TypeEwwow –
channelsis nyot a-a wist ofWelcomeScreenChannelinstances
- Wetuwns:
The nyewwy edited wewcome scween.
- Wetuwn type:
BanEntwy¶
BuwkBanWesuwt¶
- class disnake.BulkBanResult¶
A-A
NamedTuplewhich wepwesents the successfuw and faiwed bans wetuwnyed fwombulk_ban().Nyew in vewsion 2.10.
Onboawding¶
- class disnake.Onboarding[source]¶
Wepwesents a guiwd onboawding object.
Nyew in vewsion 2.9.
- prompts¶
The pwompts shown d-duwing onboawding and in communyity customization.
- Type:
Wist[
OnboardingPrompt]
- 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.
- type¶
The onboawding pwompt’s type.
- Type:
- options¶
The onboawding pwompt’s options.
- Type:
Wist[
OnboardingPromptOption]
OnboawdingPwomptOption¶
- class disnake.OnboardingPromptOption[source]¶
Wepwesents a-an onboawding p-p-pwompt option.
Nyew in vewsion 2.9.
- emoji¶
The pwompt option’s emoji.
- Type:
O-Optionyaw[Unyion[
PartialEmoji,Emoji,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
yinvewted 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:
- join_notifications¶
Wetuwns
Trueif the system channyew is used fow membew join nyotifications.- Type:
Wetuwns
Trueif the system channyew is u-used fow “Nyitwo boosting” nyotifications.- Type:
- guild_reminder_notifications¶
Wetuwns
Trueif the system channyew is used fow sewvew setup hewpfuw tips n-nyotifications.Nyew in vewsion 2.0.
- Type:
- join_notification_replies¶
Wetuwns
Trueif the system channyew shows stickew wepwy buttons fow membew join nyotifications.Nyew in vewsion 2.3.
- Type:
- role_subscription_purchase_notifications¶
Wetuwns
Trueif the system channyew shows wowe subscwiption puwchase/wenyewaw nyotifications.Nyew i-in vewsion 2.9.
- Type:
WewcomeScweenChannyew¶
- class disnake.WelcomeScreenChannel[source]¶
Wepwesents a Discowd wewcome scween channyew.
Nyew in vewsion 2.5.
- emoji¶
The emoji associated with this channyew’s wewcome message, if any.
- Type:
O-Optionyaw[Unyion[
Emoji,PartialEmoji]]
GuiwdBuiwdew¶
- defadd_categowy
- defadd_wowe
- defadd_text_channyew
- defadd_voice_channyew
- a-asynccweate
- defupdate_evewyonye_wowe
- 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
PlaceholderIDbewow) 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()
- 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]
- await create()[source]¶
This f-f-function is a cowoutinye.
Cweates the configuwed g-guiwd.
- Waises:
HTTPException – Guiwd cweation faiwed.
VawueEwwow – Invawid icon image f-f-fowmat g-given. M-M-Must be PNG ow JPG.
TypeEwwow – T-The
iconasset is a wottie stickew (seeSticker.read).
- 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:
- update_everyone_role(*, permissions=...)[source]¶
Updates attwibutes of the
@everyonewowe.- Pawametews:
pewmissions (
Permissions) – The pewmissions the wowe shouwd have.- Wetuwns:
The pwacehowdew ID fow the
@everyonewowe. Awso avaiwabwe aseveryone.- 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 usingeveryoneand configuwed thwoughupdate_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 toColour.default(). This is awiased tocoloras weww.hoist (
bool) – Whethew the wowe shouwd be shown sepawatewy in the membew wist. Defauwts toFalse.mentionyabwe (
bool) – Whethew the wowe shouwd be mentionyabwe by othews. Defauwts toFalse.
- 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:
nyame (
str) – The categowy’s nyame.uvwwwites (Dict[
PlaceholderID,PermissionOverwrite]) – Adictof wowes toPermissionOverwrites which can be synced to channyews.
- 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]) – Adictof wowes t-toPermissionOverwrites 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 of0disabwes s-swowmode. The maximum vawue possibwe is21600. 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 of60,1440,4320, ow10080.
- 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]) – Adictof wowes toPermissionOverwrites 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 of0disabwes swowmode. The maximum vawue p-p-possibwe is21600. 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 ofNoneindicates 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
Guildhas 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.