Channyews¶
This section documents evewything wewated to channyews and thweads.
Discowd Modews¶
T-TextChannyew¶
- d-d-defawchived_thweads
- asynccwonye
- asynccweate_invite
- asynccweate_thwead
- asynccweate_webhook
- asyncdewete
- asyncdewete_messages
- asyncedit
- a-a-asyncfetch_message
- asyncfowwow
- defget_pawtiaw_message
- defget_thwead
- defhistowy
- asyncinvites
- defis_nyews
- d-d-defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- asyncpins
- asyncpuwge
- asyncsend
- asyncset_pewmissions
- asynctwiggew_typing
- deftyping
- asyncw-webhooks
- class disnake.TextChannel[source]¶
Wepwesents a Discowd guiwd text channyew.
- x == y
Checks if two channyews awe equaw.
- x != y
Checks if two channyews awe nyot equaw.
- hash(x)
Wetuwns the channyew’s hash.
- str(x)
Wetuwns the channyew’s nyame.
- position¶
The position i-in the channyew wist. This is a nyumbew that stawts at 0. e-e-e.g. the top channyew is position 0.
- Type:
- last_message_id¶
The wast message ID of the message sent to this channyew. It may nyot point to an existing ow vawid message.
- Type:
Optionyaw[
int]
- slowmode_delay¶
The nyumbew of seconds a membew must wait between sending messages in this channyew.
A v-vawue of 0 denyotes that it is disabwed. Bots, and usews with
manage_channelsowmanage_messagespewmissions, bypass swowmode.See awso
default_thread_slowmode_delay.- Type:
- default_thread_slowmode_delay¶
The defauwt nyumbew of seconds a membew must wait between sending messages in nyewwy cweated thweads in this channyew.
A vawue of
0denyotes that it i-is disabwed. Bots, and usews withmanage_channelsowmanage_messages, bypass swowmode.Nyew in vewsion 2.8.
- Type:
- nsfw¶
Whethew the channyew is mawked as “nyot safe fow wowk”.
Nyote
To check if the channyew ow the guiwd o-o-of that channyew awe mawked as NSFW, considew
is_nsfw()instead.- Type:
- default_auto_archive_duration¶
The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew.
Nyew in vewsion 2.0.
- Type:
- last_pin_timestamp¶
The time the most wecent message was pinnyed, ow
Noneif nyo message is cuwwentwy pinnyed.Nyew in vewsion 2.5.
- Type:
Optionyaw[
datetime.datetime]
- async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to use this.Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages b-befowe this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages a-a-aftew this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound t-t-this date ow message. If a datetime is pwovided, it is w-wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time. When using this awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at m-most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
Fowbidden – You do nyot have pewmissions to get channyew message histowy.
HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– The message with the message data pawsed.
- async with typing()[source]¶
Wetuwns a-a context manyagew that a-awwows you to type fow an indefinyite pewiod o-o-of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
This is b-b-both a weguwaw context manyagew and an async context manyagew. This means that b-both
withandasync withwowk with this.E-Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property type[source]¶
The channyew’s Discowd type.
This awways wetuwns
ChannelType.textowChannelType.news.- Type:
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes p-pewmission wesowution fow the
MemberowRole.This function takes into considewation the f-fowwowing cases:
Guiwd ownyew
Guiwd wowes
Channyew uvwwides
Membew uvwwides
Timeouts
If a
Roleis passed, then it checks the pewmissions someonye with that wowe wouwd have, which is essentiawwy:The defauwt wowe pewmissions
The p-pewmissions of the wowe used as a pawametew
The defauwt wowe pewmission uvwwwites
The pewmission uvwwwites of the w-w-wowe used as a pawametew
Nyote
If the channyew owiginyated fwom an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsinstead.Changed in vewsion 2.0: The object passed i-i-in can nyow be a wowe object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object to wesowve pewmissions fow. This couwd be eithew a m-membew ow a wowe. If it’s a wowe then membew uvwwwites awe nyot computed.i-ignyowe_timeout (
bool) –Whethew ow nyot t-t-to ignyowe the usew’s timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This onwy appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed t-t-to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- property threads[source]¶
Wetuwns aww the thweads that y-you can see.
Nyew in vewsion 2.0.
- Type:
Wist[
Thread]
- property last_message[source]¶
Gets the wast message in this channyew fwom the cache.
The message might nyot be vawid ow point to an existing m-message.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching t-the wast message, considew using eithew
history()owfetch_message()with thelast_message_idattwibute.- Wetuwns:
The wast message in this channyew ow
Noneif n-nyot found.- Wetuwn type:
O-O-Optionyaw[
Message]
- await edit(*, name=..., topic=..., position=..., nsfw=..., sync_permissions=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., type=..., overwrites=..., flags=..., reason=None, **kwargs)[source]¶
This function is a c-c-cowoutinye.
Edits the channyew.
You must have
manage_channelspewmission to do this.Changed in vewsion 1.3: The
overwriteskeywowd-onwy pawametew was added.Changed in vewsion 1.4: The
typekeywowd-onwy pawametew was added.Changed in vewsion 2.0: Edits awe nyo wongew in-pwace, the nyewwy edited channyew is wetuwnyed i-i-instead.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrori-i-instead ofInvalidArgument.- Pawametews:
nyame (
str) – The nyew channyew’s nyame.topic (Optionyaw[
str]) – The nyew channyew’s topic.position (
int) – The nyew channyew’s position.nsfw (
bool) – Whethew to m-m-mawk the channyew as NSFW.s-sync_pewmissions (
bool) – Whethew to sync pewmissions with the channyew’s nyew ow p-pwe-existing categowy. Defauwts toFalse.c-c-categowy (Optionyaw[
abc.Snowflake]) – The nyew categowy fow this channyew. Can beNoneto wemuv the categowy.swowmode_deway (Optionyaw[
int]) – Specifies the s-swowmode wate wimit fow usews in this channyew, in seconds. A vawue of0disabwes swowmode. The m-maximum vawue possibwe is21600.defauwt_thwead_swowmode_deway (Optionyaw[
int]) –Specifies the swowmode wate wimit at which usews can send messages in n-n-nyewwy cweated t-thweads in this channyew, in seconds. This does nyot appwy wetwoactivewy to existing thweads. A vawue of
0owNonedisabwes swowmode. The maximum vawue p-p-possibwe is21600.Nyew i-i-in vewsion 2.8.
type (
ChannelType) – The nyew type of this text channyew. C-C-Cuwwentwy, onwy convewsion betweenChannelType.textandChannelType.newsis s-s-suppowted. This is onwy avaiwabwe to guiwds that containNEWSinGuild.features.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew.defauwt_auto_awchive_duwation (Optionyaw[Unyion[
int,ThreadArchiveDuration]]) – The nyew defauwt auto awchive duwation in minyutes fow t-t-thweads cweated in this channyew. Must b-be onye of60,1440,4320, ow10080.fwags (
ChannelFlags) –The nyew fwags to set fow t-t-this channyew. This wiww uvwwwite any e-e-existing fwags set on this channyew.
Nyew i-i-in vewsion 2.6.
weason (Optionyaw[
str]) – The weason fow editing this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the channyew.
HTTPException – Editing the channyew faiwed.
TypeEwwow – The p-pewmission uvwwwite infowmation is nyot in pwopew fowm.
V-VawueEwwow – The position is wess than 0.
- Wetuwns:
The nyewwy edited text channyew. If the e-e-edit was onwy positionyaw then
Noneis wetuwnyed instead.- Wetuwn type:
Optionyaw[
TextChannel]
- await clone(*, name=None, topic=..., position=..., nsfw=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., overwrites=..., news=..., reason=None)[source]¶
This function is a-a-a cowoutinye.
Cwonyes this channyew. This cweates a-a-a channyew with the s-s-same pwopewties as this channyew.
You must have
Permissions.manage_channelspewmission to do this.Changed in v-v-vewsion 2.9: Added
topic,position,nsfw,category,slowmode_delay,default_thread_slowmode_delay,default_auto_archive_duration,newsandoverwriteskeywowd-onwy pawametews.Nyote
The cuwwent
TextChannel.flagsvawue won’t be cwonyed. This is a Discowd wimitation.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the nyew channyew. If nyot pwovided, defauwts to this channyew’s nyame.topic (Optionyaw[
str]) – The topic of the nyew channyew. If nyot pwovided, defauwts to t-this c-c-channyew’s topic.position (
int) – The position of the nyew channyew. If nyot pwovided, defauwts to this channyew’s position.nsfw (
bool) – Whethew the nyew channyew shouwd be m-m-mawked as NSFW. If nyot pwovided, defauwts to this channyew’s NSFW vawue.categowy (Optionyaw[
abc.Snowflake]) – The categowy whewe the nyew channyew shouwd be gwouped. If n-nyot p-pwovided, d-d-defauwts to this channyew’s categowy.swowmode_deway (
int) – The swowmode of the nyew channyew. If n-n-nyot pwovided, d-defauwts to this channyew’s swowmode.defauwt_thwead_swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit at which usews can send messages in nyewwy cweated thweads i-in this channyew, in seconds. This does nyot appwy wetwoactivewy to existing thweads. A vawue of0owNonedisabwes swowmode. The maximum vawue possibwe is21600. If nyot pwovided, defauwts to this channyew’s defauwt thwead swowmode deway.defauwt_auto_awchive_duwation (Unyion[
int,ThreadArchiveDuration]) – The defauwt auto awchive duwation of the nyew channyew. If nyot pwovided, defauwts to this channyew’s defauwt auto awchive duwation.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew. If nyot pwovided, defauwts to this channyew’s uvwwwites.nyews (
bool) – Whethew the nyew channyew shouwd be a nyews channyew. Nyews channyews awe text channyews that can be fowwowed. This is onwy avaiwabwe to guiwds that containNEWSinGuild.features. If nyot pwovided, defauwts to t-t-the c-cuwwent type of this channyew.weason (Optionyaw[
str]) – The weason fow cwonying 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.
- Wetuwns:
The nyewwy cweated text channyew.
- Wetuwn t-t-type:
- await delete_messages(messages)[source]¶
This function is a cowoutinye.
Dewetes a w-w-wist o-o-of messages. This is simiwaw to
Message.delete()except it buwk dewetes muwtipwe messages.As a-a speciaw case, if the n-nyumbew of messages is 0, then nyothing is donye. If the nyumbew of messages is 1 then singwe message dewete is donye. If i-it’s mowe than two, then buwk dewete is used.
You cannyot buwk dewete mowe than 100 messages ow messages that awe owdew than 14 days.
You must have
manage_messagespewmission to do this.- Pawametews:
messages (Itewabwe[
abc.Snowflake]) – An itewabwe of messages denyoting which onyes to buwk dewete.- Waises:
CwientException – The nyumbew of messages t-to d-dewete was mowe than 100.
F-Fowbidden – You do nyot h-h-have p-pwopew pewmissions to dewete the messages.
NyotFound – If singwe dewete, then the message was awweady deweted.
HTTPException – D-D-Deweting the messages faiwed.
- await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)[source]¶
This function is a cowoutinye.
Puwges a wist of messages that meet the cwitewia given by the pwedicate
check. If acheckis nyot pwovided then aww messages awe deweted without discwiminyation.You m-m-must have
manage_messagespewmission to dewete messages even if they awe youw own.read_message_historypewmission i-is awso nyeeded to wetwieve message histowy.Exampwes
Deweting bot’s messages
def is_me(m): return m.author == client.user deleted = await channel.purge(limit=100, check=is_me) await channel.send(f'Deleted {len(deleted)} message(s)')
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to s-s-seawch thwough. This is nyot the nyumbew of messages that wiww be deweted, though it can be.check (Cawwabwe[[
Message],bool]) – The function used to check i-i-if a message shouwd be deweted. It must take aMessageas its sowe pawametew.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asbeforeinhistory().aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asafterinhistory().awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asaroundinhistory().owdest_fiwst (Optionyaw[
bool]) – Same asoldest_firstinhistory().buwk (
bool) – IfTrue, use b-b-buwk dewete. Setting this toFalseis usefuw fow mass-deweting a bot’s own messages withoutPermissions.manage_messages. WhenTrue, wiww faww back to singwe dewete if messages awe o-owdew than t-two weeks.
- Waises:
Fowbidden – You do nyot have pwopew pewmissions to do the actions wequiwed.
HTTPException – Puwging the messages faiwed.
- Wetuwns:
A wist of messages that wewe deweted.
- Wetuwn type:
Wist[
Message]
- await webhooks()[source]¶
This function is a cowoutinye.
Wetwieves the wist of webhooks this channyew has.
You must have
manage_webhookspewmission to use this.
- await create_webhook(*, name, avatar=None, reason=None)[source]¶
This function i-i-is a cowoutinye.
Cweates a webhook fow this channyew.
You must have
manage_webhookspewmission to do this.Changed in vewsion 1.1: The
reasonkeywowd-onwy pawametew was a-a-added.- Pawametews:
nyame (
str) – The webhook’s n-n-nyame.avataw (Optionyaw[Unyion[
bytes,Asset,Emoji,PartialEmoji,StickerItem,Sticker]]) –The webhook’s defauwt avataw. This opewates simiwawwy to
edit().Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to
bytes.weason (Optionyaw[
str]) – The weason fow cweating this webhook. Shows up in the audit wogs.
- Waises:
NyotFound – The
avatara-a-asset couwdn’t be f-f-found.Fowbidden – You d-do nyot have pewmissions to cweate a webhook.
H-HTTPException – Cweating the webhook faiwed.
T-TypeEwwow – T-The
avatarasset is a wottie stickew (seeSticker.read()).
- Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- await follow(*, destination, reason=None)[source]¶
This function is a-a cowoutinye.
Fowwows a channyew using a webhook.
Onwy nyews channyews can be fowwowed.
Nyote
The webhook wetuwnyed w-wiww nyot pwovide a-a-a token to do webhook actions, as Discowd does nyot pwovide i-it.
Nyew in vewsion 1.3.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
destinyation (
TextChannel) – The channyew you wouwd w-wike to fowwow f-fwom.weason (Optionyaw[
str]) –The weason fow fowwowing the channyew. S-Shows up on the destinyation guiwd’s a-a-audit wog.
Nyew in vewsion 1.4.
- Waises:
HTTPException – Fowwowing the channyew faiwed.
Fowbidden – You do nyot have the pewmissions to cweate a webhook.
TypeEwwow – The cuwwent ow pwovided channyew is nyot of the cowwect type.
- Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom the given message ID.This i-is u-u-usefuw if you want to wowk with a message and onwy have its ID without doing an unnyecessawy API caww.
Nyew in vewsion 1.6.
- Pawametews:
message_id (
int) – The message ID to cweate a pawtiaw message fow.- Wetuwns:
The pawtiaw message object.
- Wetuwn type:
- await create_thread(*, name, message=None, auto_archive_duration=None, type=None, invitable=None, slowmode_delay=None, reason=None)[source]¶
This function is a-a cowoutinye.
Cweates a-a-a thwead in this text channyew.
To cweate a pubwic thwead, you must have
create_public_threadspewmission. Fow a pwivate thwead,create_private_threadspewmission is n-n-nyeeded instead.Nyew in vewsion 2.0.
Changed in vewsion 2.5:
Onwy onye of
messageandtypemay be pwovided.typeis nyow wequiwed ifmessageis nyot pwovided.
- Pawametews:
nyame (
str) – The nyame of the thwead.message (
abc.Snowflake) –A snyowfwake wepwesenting the message to cweate the thwead with.
Changed in v-v-vewsion 2.5: Cannyot be pwovided with
type.type (
ChannelType) –The type of t-t-thwead to cweate.
Changed in vewsion 2.5: Cannyot be pwovided with
message. Nyow wequiwed if message is nyot pwovided.auto_awchive_duwation (Unyion[
int,ThreadArchiveDuration]) – The duwation in minyutes befowe a thwead is automaticawwy awchived fow inyactivity. If nyot pwovided, the channyew’s defauwt auto awchive duwation is used. Must be o-onye of60,1440,4320, ow10080.invitabwe (
bool) –Whethew n-n-nyon-modewatows can add othew nyon-modewatows to this thwead. Onwy avaiwabwe fow pwivate thweads. If a
messageis passed then this pawametew is ignyowed, as a thwead cweated with a message is awways a pubwic thwead. Defauwts toTrue.Nyew in vewsion 2.3.
swowmode_deway (Optionyaw[
int]) –Specifies the swowmode wate wimit fow u-usews in this thwead, in seconds. A vawue of
0disabwes swowmode. The maximum vawue possibwe is21600. If set toNoneow nyot pwovided, swowmode is inhewited fwom the pawent’sdefault_thread_slowmode_delay.Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating t-t-the thwead. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to cweate a thwead.
HTTPException – Stawting the thwead faiwed.
- Wetuwns:
The nyewwy cweated thwead
- Wetuwn type:
- archived_threads(*, private=False, joined=False, limit=50, before=None)[source]¶
Wetuwns an
AsyncIteratorthat itewates uvw aww a-a-awchived thweads in the channyew.You must have
read_message_historypewmission to use this. If itewating uvw pwivate thweads thenmanage_threadspewmission is awso wequiwed.Nyew in vewsion 2.0.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of thweads to wetwieve. IfNone, wetwieves evewy awchived thwead in the channyew. Nyote, h-howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve awchived channyews befowe the given date ow ID.pwivate (
bool) – Whethew to wetwieve pwivate awchived thweads.joinyed (
bool) – Whethew to wetwieve pwivate awchived thweads that you’ve joinyed. You cannyot setjoinedtoTrueandprivatetoFalse.
- Waises:
Fowbidden – You do nyot have p-p-pewmissions to get a-a-awchived thweads.
HTTPException – The wequest to get the awchived thweads faiwed.
- Yiewds:
Thread– The awchived thweads.
- property category[source]¶
The categowy this c-channyew bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist of wowes that have been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- Type:
Wist[
Role]
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
This function is a cowoutinye.
Cweates an instant invite f-fwom a text ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- Pawametews:
max_age (
int) – How wong the invite shouwd wast in seconds. If set to0, then the invite doesn’t expiwe. Defauwts to0.max_uses (
int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts t-to0.tempowawy (
bool) – Whethew the invite gwants tempowawy m-m-membewship (i.e. they get kicked aftew they disconnyect). Defauwts toFalse.unyique (
bool) – Whethew a unyique invite UWW shouwd be cweated. Defauwts t-toTrue. If this is set t-t-toFalsethen it wiww wetuwn a-a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The t-type of tawget fow the voice channyew invite, if any.
Nyew in vewsion 2.0.
tawget_usew (Optionyaw[
User]) –The usew whose stweam to dispway fow t-t-this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
tawget_appwication (Optionyaw[
Snowflake]) –The ID of the embedded appwication fow the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew i-i-in vewsion 2.0.
Changed i-in v-vewsion 2.9:
PartyTypeis depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The g-guiwd scheduwed event to incwude with the invite.
Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating this invite. Shows up on the audit wog.
- Waises:
HTTPException – I-Invite cweation faiwed.
NyotFound – The channyew that was passed is a categowy ow an invawid channyew.
- Wetuwns:
The nyewwy cweated i-invite.
- Wetuwn type:
- await delete(*, reason=None)[source]¶
This function is a cowoutinye.
Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to do this.- Pawametews:
weason (Optionyaw[
str]) – The weason fow deweting this channyew. S-S-Shows up on the audit wog.- Waises:
Fowbidden – Y-Y-You do nyot have pwopew pewmissions to dewete the channyew.
NyotFound – The channyew was nyot found ow was awweady deweted.
HTTPException – Deweting the channyew faiwed.
- await fetch_message(id, /)[source]¶
This f-function is a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message was nyot found.
Fowbidden – You do nyot have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving t-the message faiwed.
- Wetuwns:
The message asked fow.
- W-W-Wetuwn type:
- await invites()[source]¶
This function is a cowoutinye.
Wetuwns a wist of aww active instant invites fwom this channyew.
Y-You must have
Permissions.manage_channelspewmission to u-u-use this.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to get the infowmation.
HTTPException – An ewwow occuwwed whiwe f-f-fetching the infowmation.
- Wetuwns:
The wist of invites that awe cuwwentwy active.
- Wetuwn type:
Wist[
Invite]
- property jump_url[source]¶
A UWW that can be used t-t-to jump t-t-to this channyew.
Nyew in vewsion 2.4.
Nyote
This exists fow aww guiwd channyews but may nyot be usabwe by the cwient fow aww guiwd c-c-channyew types.
- await move(**kwargs)[source]¶
This function is a cowoutinye.
A wich intewface to hewp muv a channyew wewative to othew channyews.
If exact position muvment is wequiwed,
editshouwd be used instead.You must have
Permissions.manage_channelspewmission to do this.Nyote
Voice channyews wiww awways b-b-be sowted bewow text channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed in vewsion 2.6: Waises
TypeErroro-o-owValueErrorinstead ofInvalidArgument.- Pawametews:
beginnying (
bool) – Whethew t-t-to muv the channyew to t-the beginnying of the channyew wist (ow categowy if given). This is mutuawwy excwusive withend,before, andafter.e-e-end (
bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This is mutuawwy excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The channyew that shouwd be befowe ouw cuwwent channyew. This is m-mutuawwy excwusive withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew that shouwd be aftew o-ouw cuwwent channyew. This is mutuawwy excwusive w-w-withbeginning,end, andbefore.offset (
int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset of2withbeginning=Truewouwd m-muv it 2 a-a-aftew the beginnying. A positive nyumbew muvs it bewow whiwe a nyegative nyumbew muvs it abuv. Nyote that this nyumbew is wewative and computed aftew thebeginning,end,before, andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to m-m-muv this channyew u-u-undew. IfNonei-i-is given then it muvs it out of the categowy. This pawametew is ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync the pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The weason fow moving this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to muv the channyew.
HTTPException – Moving the channyew faiwed.
TypeEwwow – A bad mix of awguments wewe passed.
VawueEwwow – An invawid position was given.
- property overwrites[source]¶
Wetuwns aww of the channyew’s uvwwwites.
This is wetuwnyed as a dictionyawy whewe the key contains the tawget which can be eithew a
Roleow aMemberand the vawue is the uvwwwite as aPermissionOverwrite.- Wetuwns:
The channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
Wetuwns the channyew-specific uvwwwites fow a membew ow a wowe.
- property permissions_synced[source]¶
Whethew ow nyot the pewmissions fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then this is
False.Nyew in vewsion 1.3.
- Type:
- await pins()[source]¶
This function is a cowoutinye.
W-Wetwieves aww messages that awe cuwwentwy pinnyed in the channyew.
N-N-Nyote
Due to a w-w-wimitation with t-t-the Discowd A-API, the
Messageobjects wetuwnyed by this m-m-method do nyot contain compweteMessage.reactionsdata.- Waises:
HTTPException – Wetwieving the pinnyed messages faiwed.
- Wetuwns:
The messages that awe c-cuwwentwy pinnyed.
- Wetuwn type:
Wist[
Message]
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function is a-a-a cowoutinye.
Sends a message to t-t-the destinyation with the content given.
The content must be a type that can convewt to a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filepawametew shouwd b-be used with a singweFileobject. T-To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying both pawametews wiww wead to an exception.To upwoad a singwe embed, the
embedpawametew shouwd be used with a-a-a singweEmbedobject. To upwoad muwtipwe embeds, theembedspawametew shouwd b-b-be used with alistofEmbedobjects. Specifying both pawametews w-w-wiww wead to a-a-an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. T-This cannyot be mixed w-w-with theembedspawametew.embeds (Wist[
Embed]) –A wist of embeds to send with t-t-the content. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – The fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (W-Wist[
File]) – A w-w-wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be m-mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of s-stickews to upwoad. M-M-Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the n-n-nyumbew of seconds to wait in the backgwound befowe deweting the message we just sent. If the dewetion faiws, then it is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging behaviouw onwy uvwwides a-attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object i-i-is passed at aww then the d-defauwts given byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
wefewence (U-Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to the
Messageto which you awe wepwying, t-this can be cweated usingMessage.to_reference()ow passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To f-fowwawd a message you must expwicitwy twansfowm the message to aMessageReferenceu-usingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides t-the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. This cannyot b-be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A w-w-wist of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
poww (
Poll) –The poww to send with the m-m-message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – Specified both
filea-andfiles, ow you specified b-bothembedandembeds, o-ow you specified bothviewandcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedsw-wist i-i-is too wawge, ow you t-twied to send v2 componyents togethew withcontent,embeds,stickers, owpoll.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
Sets the channyew specific pewmission uvwwwites f-fow a tawget in the channyew.
The
targetpawametew shouwd eithew be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyotingPermissionsattwibutes. If this i-i-is donye, then you cannyot mix the keywowd awguments with theoverwritepawametew.If the
overwritepawametew isNone, then the pewmission uvwwwites awe deweted.You must have
Permissions.manage_rolespewmission to do this.Nyote
This method wepwaces the owd uvwwwites with the onyes given.
C-Changed in vewsion 2.6: Waises
TypeErrorinstead o-o-ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting u-u-uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – The membew ow wowe to uvwwwite pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – T-T-The pewmissions to awwow and deny to the tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument wist of pewmissions to s-s-set fow ease of use. Cannyot be mixed with
overwrite.weason (O-O-Optionyaw[
str]) – The weason fow doing this action. Shows up o-on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit c-channyew specific pewmissions.
HTTPException – Editing channyew specific pewmissions faiwed.
NyotFound – The wowe ow membew being edited is nyot pawt of the guiwd.
TypeEwwow –
overwriteis invawid, the tawget type was nyotRoleowMember, b-b-both keywowd awguments andoverwritewewe pwovided, ow invawid pewmissions wewe pwovided as keywowd awguments.
- await trigger_typing()[source]¶
This f-function is a cowoutinye.
Twiggews a typing indicatow to the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow aftew a message is sent.
VoiceChannyew¶
- asynccwonye
- asyncconnyect
- asynccweate_invite
- asynccweate_webhook
- asyncdewete
- asyncd-d-dewete_messages
- asyncedit
- asyncfetch_message
- defg-get_pawtiaw_message
- defhistowy
- asyncinvites
- d-defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- asyncpuwge
- asyncsend
- asyncsend_soundboawd_sound
- asyncset_pewmissions
- asynctwiggew_typing
- deftyping
- asyncwebhooks
- class disnake.VoiceChannel[source]¶
Wepwesents a-a D-D-Discowd guiwd voice channyew.
- x == y
Checks if two c-c-channyews awe equaw.
- x != y
Checks if two channyews awe nyot equaw.
- hash(x)
W-Wetuwns the channyew’s hash.
- str(x)
Wetuwns the channyew’s nyame.
- category_id¶
The categowy channyew ID this c-c-channyew bewongs to, if a-a-appwicabwe.
- Type:
Optionyaw[
int]
- position¶
The position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.
- Type:
- rtc_region¶
The wegion fow the voice channyew’s voice communyication. A vawue of
Noneindicates automatic voice wegion detection.Nyew in v-vewsion 1.7.
Changed in vewsion 2.5: Nyo wongew a
VoiceRegioninstance.- Type:
Optionyaw[
str]
- video_quality_mode¶
The camewa video quawity fow the voice channyew’s pawticipants.
- T-T-Type:
- nsfw¶
Whethew the channyew is mawked as “nyot safe fow wowk”.
Nyote
To check if the channyew ow the guiwd of that channyew awe mawked as NSFW, considew
is_nsfw()instead.Nyew in vewsion 2.3.
- Type:
- slowmode_delay¶
The nyumbew of seconds a membew must wait between sending messages in this channyew. A vawue of 0 denyotes that it is disabwed. Bots, and usews with
manage_channelsowmanage_messages, bypass swowmode.Nyew in vewsion 2.3.
- Type:
- last_message_id¶
The wast message ID of the message sent to this channyew. It may nyot point to an existing ow vawid message.
Nyew in vewsion 2.3.
- Type:
Optionyaw[
int]
- property type[source]¶
The c-channyew’s D-Discowd type.
This awways wetuwns
ChannelType.voice.- Type:
- await clone(*, name=None, bitrate=..., user_limit=..., position=..., category=..., rtc_region=..., video_quality_mode=..., nsfw=..., overwrites=..., slowmode_delay=..., reason=None)[source]¶
This function is a cowoutinye.
Cwonyes this channyew. This cweates a channyew with the same pwopewties as this channyew.
You must have
Permissions.manage_channelspewmission to do this.Changed i-i-in vewsion 2.9: Added
bitrate,user_limit,position,category,rtc_region,video_quality_mode,nsfw,slowmode_delayandoverwriteskeywowd-onwy pawametews.Nyote
The cuwwent
VoiceChannel.flagsvawue won’t be cwonyed. This is a-a-a Discowd wimitation.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the nyew channyew. If nyot pwovided, defauwts to this channyew’s nyame.bitwate (
int) – The bitwate of the nyew channyew. If nyot pwovided, defauwts to t-t-this channyew’s b-b-bitwate.usew_wimit (
int) – The usew wimit of the nyew channyew. If nyot pwovided, defauwts to this channyew’s usew wimit.position (
int) – The position of the nyew channyew. If n-nyot pwovided, defauwts to this channyew’s position.categowy (Optionyaw[
abc.Snowflake]) – The categowy whewe the n-n-nyew channyew shouwd be gwouped. If nyot pwovided, defauwts to this channyew’s categowy.wtc_wegion (Optionyaw[Unyion[
str,VoiceRegion]]) – The wtc wegion of the nyew c-channyew. If nyot pwovided, defauwts to this channyew’s wtc wegion.video_quawity_mode (
VideoQualityMode) – The video q-q-quawity mode of the n-nyew channyew. If nyot pwovided, defauwts to this c-c-channyew’s video quawity mode.nsfw (
bool) – Whethew the nyew channyew shouwd be nsfw ow nyot. If nyot pwovided, defauwts to this channyew’s NSFW vawue.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew. If nyot pwovided, defauwts to this channyew’s uvwwwites.swowmode_deway (O-O-Optionyaw[
int]) – The swowmode of the n-nyew c-c-channyew. If nyot pwovided, defauwts to this c-c-channyew’s swowmode.weason (Optionyaw[
str]) – The w-weason fow cwonying this channyew. Shows u-u-up on the audit wog.
- Waises:
Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.
HTTPException – Cweating the channyew faiwed.
- Wetuwns:
The channyew that was cweated.
- Wetuwn type:
- property last_message[source]¶
Gets the wast message in this channyew fwom the c-cache.
The message might nyot be vawid ow point to an e-existing message.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching the wast message, considew using eithew
history()owfetch_message()with thelast_message_idattwibute.Nyew in v-v-vewsion 2.3.
- Wetuwns:
The wast message in this channyew ow
Noneif nyot found.- Wetuwn type:
Optionyaw[
Message]
- get_partial_message(message_id, /)[source]¶
C-C-Cweates a
PartialMessagefwom the given message ID.T-This is usefuw if you want to wowk with a message and onwy have its ID without doing an unnyecessawy API caww.
Nyew in vewsion 2.3.
- Pawametews:
message_id (
int) – The m-m-message ID to cweate a pawtiaw m-message fow.- Wetuwns:
T-T-The pawtiaw message object.
- Wetuwn type:
- await edit(*, name=..., bitrate=..., user_limit=..., position=..., sync_permissions=..., category=..., overwrites=..., rtc_region=..., video_quality_mode=..., nsfw=..., slowmode_delay=..., flags=..., reason=None, **kwargs)[source]¶
This function is a cowoutinye.
Edits the channyew.
You must have
manage_channelspewmission to do this.Changed in vewsion 1.3: The
overwriteskeywowd-onwy pawametew was added.Changed in vewsion 2.0: Edits awe nyo wongew in-pwace, the nyewwy edited channyew is wetuwnyed instead.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – T-T-The channyew’s nyew nyame.bitwate (
int) – The channyew’s nyew bitwate.usew_wimit (
int) – The channyew’s nyew usew wimit.position (
int) – The channyew’s nyew position.sync_pewmissions (
bool) – Whethew to sync pewmissions with the channyew’s nyew ow pwe-existing categowy. Defauwts toFalse.c-c-categowy (Optionyaw[
abc.Snowflake]) – The nyew categowy fow this channyew. Can beNoneto wemuv the categowy.weason (Optionyaw[
str]) – The weason fow editing this channyew. Shows up on the audit wog.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew.wtc_wegion (Optionyaw[Unyion[
str,VoiceRegion]]) –The nyew wegion fow the voice channyew’s voice communyication. A v-v-vawue of
Noneindicates automatic voice w-w-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 a-a-as NSFW.
Nyew in vewsion 2.3.
swowmode_deway (Optionyaw[
int]) –Specifies the swowmode wate wimit fow usews in t-this channyew, in seconds. A vawue of
0disabwes swowmode. The maximum vawue possibwe is21600.Nyew in vewsion 2.3.
fwags (
ChannelFlags) –The nyew fwags to set fow this channyew. This wiww uvwwwite a-a-any existing fwags set on this channyew.
Nyew in vewsion 2.6.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the channyew.
HTTPException – Editing the channyew faiwed.
TypeEwwow – T-The pewmission uvwwwite infowmation is nyot in pwopew fowm.
VawueEwwow – The position i-is wess than 0.
- Wetuwns:
The nyewwy edited voice channyew. If the e-e-edit was onwy positionyaw then
Noneis wetuwnyed instead.- Wetuwn type:
Optionyaw[
VoiceChannel]
- await delete_messages(messages)[source]¶
T-T-This function is a cowoutinye.
Dewetes a wist of messages. This is simiwaw to
Message.delete()except it buwk dewetes muwtipwe messages.As a speciaw case, if the nyumbew of messages is 0, then nyothing is donye. If the nyumbew of messages is 1 then singwe message dewete is donye. If it’s mowe than two, then buwk dewete is used.
You cannyot buwk dewete mowe than 100 messages o-o-ow messages that awe owdew than 14 days.
You must have
manage_messagespewmission to do this.Nyew in v-vewsion 2.5.
- Pawametews:
messages (Itewabwe[
abc.Snowflake]) – An itewabwe of m-m-messages denyoting which onyes to buwk dewete.- Waises:
CwientException – The nyumbew of messages to dewete was mowe than 100.
Fowbidden – You do nyot have pwopew pewmissions to dewete the messages.
NyotFound – If singwe dewete, then the message was awweady deweted.
HTTPException – Deweting the messages faiwed.
- await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)[source]¶
This function is a cowoutinye.
Puwges a wist of messages that meet the c-cwitewia given by the pwedicate
check. If a-a-acheckis nyot pwovided then aww messages awe deweted without discwiminyation.Y-You must have
manage_messagespewmission to dewete messages even if they awe y-y-youw own.read_message_historypewmission is awso nyeeded to wetwieve message histowy.Nyew in vewsion 2.5.
Nyote
See
TextChannel.purge()fow exampwes.- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to seawch thwough. This is nyot the nyumbew of m-messages that wiww be deweted, though it can b-b-be.check (Cawwabwe[[
Message],bool]) – The function used to check if a message shouwd b-b-be deweted. It must take aMessageas its sowe pawametew.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asbeforeinhistory().aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asafterinhistory().awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asaroundinhistory().owdest_fiwst (Optionyaw[
bool]) – Same asoldest_firstinhistory().buwk (
bool) – IfTrue, use buwk dewete. Setting this toFalseis usefuw f-f-fow mass-deweting a bot’s own messages withoutPermissions.manage_messages. WhenTrue, wiww faww back to singwe d-d-dewete if messages awe owdew than t-two weeks.
- W-Waises:
Fowbidden – You do nyot have pwopew pewmissions to do t-the actions wequiwed.
HTTPException – Puwging t-the messages faiwed.
- Wetuwns:
A wist of messages that wewe deweted.
- Wetuwn type:
Wist[
Message]
- await webhooks()[source]¶
T-T-This f-f-function is a cowoutinye.
Wetwieves the wist of webhooks this channyew has.
You must have
manage_webhookspewmission to use this.Nyew in vewsion 2.5.
- await create_webhook(*, name, avatar=None, reason=None)[source]¶
This f-f-function is a cowoutinye.
Cweates a webhook fow this channyew.
You must have
manage_webhookspewmission to do this.Nyew in vewsion 2.5.
- Pawametews:
- Waises:
N-N-NyotFound – The
avatara-asset couwdn’t be found.Fowbidden – You do nyot have pewmissions to cweate a webhook.
HTTPException – Cweating the webhook faiwed.
TypeEwwow – The
avatarasset is a wottie stickew (seeSticker.read()).
- Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- await send_soundboard_sound(sound, /)[source]¶
This function is a cowoutinye.
Sends a soundboawd sound in this channyew.
You must have
speakanduse_soundboardpewmissions to do this. Fow s-sounds fwom diffewent guiwds, you must awso haveuse_external_soundspewmission. Additionyawwy, you may nyot be m-m-muted ow deafenyed.- Pawametews:
sound (Unyion[
SoundboardSound,GuildSoundboardSound]) – The sound to send in the channyew.- Waises:
Fowbidden – You a-awe nyot awwowed to send soundboawd sounds.
HTTPException – An ewwow occuwwed sending the soundboawd sound.
- property category[source]¶
The categowy this channyew b-bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist of wowes t-that have been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- Type:
Wist[
Role]
- await connect(*, timeout=60.0, reconnect=True, cls=<class 'disnake.voice_client.VoiceClient'>)[source]¶
This function is a cowoutinye.
Connyects to voice and cweates a-a
VoiceClientto estabwish youw connyection to the voice sewvew.This wequiwes
Intents.voice_states.- Pawametews:
timeout (
float) – The timeout i-i-in seconds to wait fow the voice endpoint.weconnyect (
bool) – Whethew the bot shouwd automaticawwy attempt a weconnyect if a pawt of the h-h-handshake faiws ow the gateway goes down.cws (Type[
VoiceProtocol]) – A type that subcwassesVoiceProtocolto connyect with. Defauwts toVoiceClient.
- Waises:
a-a-asyncio.TimeoutEwwow – Couwd nyot connyect to the voice channyew in time.
CwientException – You awe awweady connyected to a voice channyew.
opus.OpusNyotWoaded – The opus wibwawy has nyot been woaded.
- Wetuwns:
A voice cwient that is fuwwy connyected to the voice sewvew.
- Wetuwn type:
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
This function is a cowoutinye.
Cweates an instant invite fwom a text ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- Pawametews:
max_age (
int) – How wong the invite s-shouwd wast in seconds. If set to0, then the invite doesn’t expiwe. Defauwts to0.max_uses (
int) – How many uses the invite couwd be used fow. If it’s 0 t-then thewe awe u-unwimited uses. Defauwts to0.t-tempowawy (
bool) – Whethew the invite gwants t-t-tempowawy membewship (i.e. they get kicked aftew they disconnyect). Defauwts toFalse.unyique (
bool) – Whethew a u-u-unyique invite UWW shouwd be cweated. Defauwts toTrue. If this is set t-toFalsethen it wiww wetuwn a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The type of tawget fow the voice channyew invite, if any.
Nyew in vewsion 2.0.
tawget_usew (Optionyaw[
User]) –The usew whose stweam to dispway fow this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
tawget_appwication (Optionyaw[
Snowflake]) –The ID of the embedded appwication fow the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew in vewsion 2.0.
Changed in vewsion 2.9:
PartyTypeis depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The guiwd scheduwed event to incwude with the i-invite.
Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating this invite. Shows up on the audit w-w-wog.
- Waises:
HTTPException – Invite cweation faiwed.
NyotFound – The channyew that was passed is a categowy ow an invawid channyew.
- Wetuwns:
The nyewwy cweated invite.
- Wetuwn type:
- await delete(*, reason=None)[source]¶
This function is a-a-a cowoutinye.
D-Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to do this.- Pawametews:
weason (Optionyaw[
str]) – The weason fow deweting this channyew. Shows up on the audit wog.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to dewete the channyew.
NyotFound – The channyew was nyot found o-o-ow was awweady deweted.
HTTPException – Deweting the c-c-channyew faiwed.
- await fetch_message(id, /)[source]¶
This function i-i-is a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message was nyot found.
Fowbidden – You do nyot have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving the m-message faiwed.
- Wetuwns:
The message asked fow.
- Wetuwn type:
- history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to use t-t-this.E-Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a-a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow message. If a datetime is p-pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it i-i-is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages a-a-aftew this date ow message. If a d-datetime i-i-is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the d-datetime is nyaive, it is assumed to be wocaw time. When using this awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
Fowbidden – You do nyot have pewmissions to get channyew message histowy.
HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– The message w-w-with the message d-data pawsed.
- await invites()[source]¶
This function is a cowoutinye.
Wetuwns a wist of aww active instant invites fwom this channyew.
You must have
Permissions.manage_channelspewmission to use this.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to get the infowmation.
HTTPException – An ewwow occuwwed whiwe fetching the infowmation.
- Wetuwns:
The wist of invites that awe cuwwentwy active.
- Wetuwn t-type:
Wist[
Invite]
- property jump_url[source]¶
A UWW that c-c-can be used to jump to this channyew.
Nyew in vewsion 2.4.
Nyote
This exists fow aww guiwd c-channyews but may nyot be usabwe by t-the cwient fow aww guiwd channyew types.
- property members[source]¶
Wetuwns aww membews that awe cuwwentwy inside this voice channyew.
- Type:
Wist[
Member]
- await move(**kwargs)[source]¶
This function is a cowoutinye.
A wich intewface to hewp m-muv a channyew wewative to othew channyews.
If exact p-position muvment is wequiwed,
editshouwd be used instead.You must h-h-have
Permissions.manage_channelspewmission to do this.Nyote
Voice channyews wiww awways be sowted bewow text channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- P-Pawametews:
beginnying (
bool) – Whethew to muv the channyew to the beginnying of the channyew w-w-wist (ow categowy if g-given). This is mutuawwy excwusive withend,before, andafter.end (
bool) – Whethew to muv the channyew to t-the end of the channyew wist (ow categowy if given). This is mutuawwy e-excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The channyew that s-shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew t-that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andbefore.offset (
int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an o-offset of2withbeginning=Truewouwd muv it 2 aftew the beginnying. A positive nyumbew muvs it bewow whiwe a nyegative nyumbew muvs i-it abuv. Nyote that this nyumbew is wewative and computed aftew thebeginning,end,before, andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to muv this channyew undew. IfNoneis given then it muvs it o-o-out of the categowy. This pawametew is i-i-ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync the pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The w-w-weason fow moving this c-c-channyew. Shows u-up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to muv the channyew.
HTTPException – Moving the channyew faiwed.
TypeEwwow – A bad mix o-o-of awguments wewe passed.
VawueEwwow – An invawid position was given.
- property overwrites[source]¶
Wetuwns aww of the channyew’s uvwwwites.
This is wetuwnyed as a dictionyawy whewe the key contains the tawget which can be eithew a
Roleow aMemberand the vawue is t-the uvwwwite as aPermissionOverwrite.- Wetuwns:
The channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
Wetuwns the channyew-specific uvwwwites fow a membew ow a wowe.
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes p-p-pewmission wesowution fow the
MemberowRole.This f-function takes into considewation the fowwowing cases:
Guiwd ownyew
Guiwd wowes
Channyew uvwwides
Membew uvwwides
Timeouts
If a
Roleis passed, then it checks t-the pewmissions someonye with that wowe wouwd h-have, which is essentiawwy:The defauwt wowe pewmissions
The pewmissions of the wowe used as a pawametew
The defauwt wowe pewmission uvwwwites
The pewmission uvwwwites of the wowe used as a pawametew
Nyote
If the channyew o-o-owiginyated fwom an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed a-a-appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsi-instead.Changed in vewsion 2.0: The object passed in can nyow be a wowe object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object to wesowve pewmissions fow. This couwd be e-e-eithew a membew ow a w-wowe. If it’s a wowe then membew uvwwwites awe n-nyot computed.ignyowe_timeout (
bool) –Whethew ow nyot to ignyowe the usew’s timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This onwy appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- property permissions_synced[source]¶
Whethew ow nyot the pewmissions fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then this is
False.Nyew in vewsion 1.3.
- Type:
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This f-function is a cowoutinye.
Sends a message t-t-to the destinyation with the c-content given.
The content must be a type t-that can convewt to a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filepawametew shouwd be used with a-a singweFileobject. To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying both pawametews wiww wead to an exception.To upwoad a singwe embed, the
embedpawametew shouwd be used w-with a singweEmbedobject. To upwoad muwtipwe embeds, theembedspawametew shouwd be used with alistofEmbedobjects. Specifying both pawametews wiww wead to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This c-cannyot be m-m-mixed with theembedspawametew.embeds (W-W-Wist[
Embed]) –A w-wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew.Nyew i-i-in vewsion 2.0.
fiwe (
File) – The fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A w-wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of stickews to upwoad. Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy s-sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the nyumbew of seconds to wait in the backgwound befowe d-deweting the message we just sent. If the dewetion f-f-faiws, then it is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed at aww then the defauwts given byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to t-the
Messageto which you awe wepwying, this can be cweated usingMessage.to_reference()ow passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced m-m-message using theAllowedMentions.replied_userattwibute ofallowed_mentionso-ow by settingmention_author.Nyew in v-v-vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To fowwawd a message you must expwicitwy t-t-twansfowm the message to aMessageReferenceusingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in v-v-vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. This cannyot be mixed with
components.Nyew in vewsion 2.0.
c-c-componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, W-W-Wist[WrappedComponent]]]]) –A w-w-wist of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets t-the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This h-h-hides aww the embeds fwom the UI if s-set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
poww (
Poll) –The p-p-poww to send with t-t-the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending t-the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – Specified b-both
fileandfiles, ow you specified bothembedandembeds, ow you specified bothviewandcomponents, ow thereferenceo-o-object is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is t-t-too wawge, ow you twied to send v2 componyents togethew withcontent,embeds,stickers, owpoll.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
Sets the channyew specific p-p-pewmission uvwwwites fow a tawget in the channyew.
The
targetpawametew shouwd eithew be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyotingPermissionsattwibutes. If this is donye, then you c-c-cannyot mix the keywowd awguments with theoverwritepawametew.If the
overwritepawametew isNone, then the pewmission uvwwwites awe d-d-deweted.You must have
Permissions.manage_rolespewmission to do this.Nyote
This method wepwaces the owd uvwwwites with the onyes given.
C-C-Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – The membew ow wowe to uvwwwite p-p-pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – The pewmissions to awwow and deny to the tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument wist of pewmissions to set fow ease of use. Cannyot be mixed with
overwrite.weason (Optionyaw[
str]) – T-T-The w-weason fow doing this action. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit channyew specific pewmissions.
HTTPException – Editing channyew s-s-specific pewmissions f-f-faiwed.
NyotFound – T-The wowe ow membew being edited is nyot pawt of the guiwd.
TypeEwwow –
overwriteis invawid, the tawget type was nyotRoleowMember, b-both keywowd awguments andoverwritewewe pwovided, ow i-invawid pewmissions wewe pwovided as keywowd awguments.
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow aftew a message is sent.
- typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting wong c-c-computations in youw bot.
Nyote
This is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withw-wowk with t-t-this.Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property voice_states[source]¶
Wetuwns a-a mapping of membew IDs who have voice states in this channyew.
N-N-Nyew in vewsion 1.3.
Nyote
This function is intentionyawwy wow wevew to wepwace
memberswhen the membew cache is unyavaiwabwe.- Wetuwns:
The mapping of membew ID t-t-to a voice state.
- Wetuwn type:
Mapping[
int,VoiceState]
C-C-CategowyChannyew¶
- asynccwonye
- asynccweate_fowum_channyew
- asyncc-cweate_invite
- asyncc-cweate_media_channyew
- asynccweate_stage_channyew
- asynccweate_text_channyew
- asynccweate_voice_channyew
- asyncdewete
- asyncedit
- asyncinvites
- defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- a-asyncset_pewmissions
- class disnake.CategoryChannel[source]¶
Wepwesents a Discowd channyew categowy.
These awe u-usefuw to gwoup c-c-channyews to wogicaw compawtments.
- x == y
Checks if t-two channyews awe equaw.
- x != y
Checks if two channyews awe n-n-nyot equaw.
- hash(x)
Wetuwns the categowy’s hash.
- str(x)
Wetuwns the categowy’s nyame.
- position¶
The position in the categowy wist. This is a nyumbew that stawts at 0. e-e.g. the top categowy is position 0.
- Type:
- nsfw¶
If the channyew is mawked as “nyot safe fow wowk”.
Nyote
To check if the channyew ow the guiwd of that channyew awe mawked as NSFW, considew
is_nsfw()instead.- Type:
- property type[source]¶
The channyew’s Discowd type.
This awways w-wetuwns
ChannelType.category.- Type:
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes pewmission wesowution fow the
MemberowRole.This function takes into considewation the f-f-fowwowing cases:
Guiwd ownyew
Guiwd wowes
Channyew uvwwides
Membew uvwwides
Timeouts
If a
Roleis passed, then it c-c-checks the pewmissions someonye with that wowe wouwd have, which is essentiawwy:The defauwt wowe pewmissions
The pewmissions of the wowe u-u-used as a-a-a pawametew
The defauwt wowe pewmission uvwwwites
The pewmission uvwwwites of the wowe used as a pawametew
Nyote
If the channyew owiginyated fwom an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsi-i-instead.C-C-Changed in v-vewsion 2.0: The object passed in can nyow be a wowe object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object t-to wesowve pewmissions fow. This couwd be eithew a membew ow a wowe. If it’s a wowe then membew uvwwwites awe nyot computed.ignyowe_timeout (
bool) –Whethew ow n-n-nyot to ignyowe the usew’s timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This o-onwy a-appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- await clone(*, name=None, position=..., overwrites=..., reason=None)[source]¶
This function is a cowoutinye.
Cwonyes this channyew. This cweates a channyew with the same pwopewties as this channyew.
You m-must have
Permissions.manage_channelspewmission t-t-to do this.Changed in vewsion 2.9: Added
position,nsfwandoverwriteskeywowd-onwy pawametews.Nyote
The cuwwent
CategoryChannel.flagsvawue won’t be cwonyed. This is a Discowd wimitation.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the nyew channyew. If n-n-nyot pwovided, defauwts to this channyew’s nyame.position (
int) – The position of the nyew channyew. I-If nyot pwovided, defauwts to this channyew’s position.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy t-to the channyew. If nyot pwovided, defauwts t-to this channyew’s u-u-uvwwwites.weason (Optionyaw[
str]) – The weason f-f-fow cwonying this channyew. Shows up on the a-a-audit wog.
- W-W-Waises:
Fowbidden – You do nyot have the pwopew pewmissions t-to cweate this channyew.
HTTPException – Cweating the channyew faiwed.
- Wetuwns:
T-The channyew that was cweated.
- Wetuwn type:
- await edit(*, name=..., position=..., nsfw=..., overwrites=..., flags=..., reason=None, **kwargs)[source]¶
This function is a cowoutinye.
Edits the categowy.
You must have
manage_channelspewmission to do this.Changed in vewsion 1.3: The
overwriteskeywowd-onwy pawametew was added.Changed in vewsion 2.0: Edits awe nyo wongew in-pwace, the nyewwy edited channyew is wetuwnyed instead.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The nyew categowy’s nyame.position (
int) – The nyew categowy’s position.nsfw (
bool) – Whethew to mawk the categowy as NSFW.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the categowy.fwags (
ChannelFlags) –The nyew fwags to set f-f-fow this channyew. This w-w-wiww uvwwwite any existing fwags set on this channyew.
Nyew in vewsion 2.6.
weason (Optionyaw[
str]) – The weason f-fow editing this categowy. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the categowy.
H-H-HTTPException – Editing the categowy faiwed.
TypeEwwow – The pewmission uvwwwite infowmation is nyot in p-pwopew fowm.
VawueEwwow – The position is wess than 0.
- Wetuwns:
The nyewwy edited categowy channyew. If the e-e-edit was onwy p-p-positionyaw then
Noneis w-wetuwnyed instead.- Wetuwn type:
Optionyaw[
CategoryChannel]
- await move(**kwargs)[source]¶
This function is a cowoutinye.
A wich intewface to hewp muv a channyew wewative to othew channyews.
If exact p-p-position muvment is wequiwed,
editshouwd be used instead.You must have
Permissions.manage_channelsp-p-pewmission to do this.Nyote
Voice channyews wiww awways be sowted bewow text channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
beginnying (
bool) – Whethew to muv t-the channyew to the beginnying of the channyew wist (ow categowy if given). This is mutuawwy excwusive withend,before, andafter.end (
bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This i-i-is mutuawwy excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The channyew that shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andbefore.offset (
int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset of2withbeginning=Truewouwd muv it 2 aftew the b-beginnying. A positive nyumbew muvs it bewow whiwe a-a-a nyegative nyumbew muvs it abuv. Nyote that this nyumbew is wewative and computed aftew thebeginning,end,before, andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to muv this channyew undew. IfNoneis given then it muvs it o-out of the categowy. This pawametew is ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync the pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The weason f-f-fow moving this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – Y-You d-d-do nyot have pewmissions to muv the channyew.
HTTPException – Moving the channyew faiwed.
T-T-TypeEwwow – A bad mix of awguments wewe passed.
VawueEwwow – An invawid position was given.
- property channels[source]¶
Wetuwns t-t-the channyews that awe undew this c-categowy.
T-T-These a-awe s-s-sowted by the officiaw Discowd UI, which pwaces voice channyews bewow the text channyews.
- Type:
Wist[
abc.GuildChannel]
- property text_channels[source]¶
Wetuwns the text channyews that awe undew t-t-this categowy.
- Type:
Wist[
TextChannel]
- property voice_channels[source]¶
Wetuwns the voice channyews that a-awe undew this categowy.
- T-Type:
W-W-Wist[
VoiceChannel]
- property stage_channels[source]¶
Wetuwns the stage channyews that a-awe undew this categowy.
Nyew in vewsion 1.7.
- T-T-Type:
Wist[
StageChannel]
- property forum_channels[source]¶
Wetuwns the fowum channyews that awe undew this categowy.
Nyew in vewsion 2.5.
- Type:
Wist[
ForumChannel]
- property media_channels[source]¶
Wetuwns the m-m-media channyews that awe undew this categowy.
Nyew in vewsion 2.10.
- Type:
Wist[
MediaChannel]
- await create_text_channel(name, **options)[source]¶
This f-function is a cowoutinye.
A showtcut method to
Guild.create_text_channel()to cweate aTextChannelin the categowy.- Wetuwns:
The nyewwy cweated text channyew.
- Wetuwn type:
- await create_voice_channel(name, **options)[source]¶
This f-function is a cowoutinye.
A showtcut method to
Guild.create_voice_channel()to cweate aVoiceChannelin the categowy.- Wetuwns:
The nyewwy cweated voice channyew.
- Wetuwn type:
- await create_stage_channel(name, **options)[source]¶
This function is a cowoutinye.
A showtcut m-m-method to
Guild.create_stage_channel()to cweate aStageChannelin the categowy.Nyew in vewsion 1.7.
- Wetuwns:
T-T-The nyewwy cweated stage channyew.
- Wetuwn type:
- await create_forum_channel(name, **options)[source]¶
This function i-is a cowoutinye.
A s-s-showtcut method to
Guild.create_forum_channel()to cweate aForumChannelin the categowy.Nyew in vewsion 2.5.
- Wetuwns:
The nyewwy cweated fowum channyew.
- Wetuwn type:
- await create_media_channel(name, **options)[source]¶
This function is a cowoutinye.
A s-s-showtcut method to
Guild.create_media_channel()to cweate aMediaChannelin the categowy.Nyew in vewsion 2.10.
- Wetuwns:
The nyewwy cweated media channyew.
- Wetuwn type:
- property category[source]¶
The categowy this channyew bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist of wowes that have been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- Type:
Wist[
Role]
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
This function is a cowoutinye.
Cweates an instant invite fwom a text ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- Pawametews:
max_age (
int) – How wong the invite shouwd wast i-in seconds. I-If set to0, then the invite doesn’t expiwe. Defauwts to0.max_uses (
int) – How many uses t-t-the invite couwd be used fow. I-I-If it’s 0 then thewe awe unwimited uses. Defauwts to0.tempowawy (
bool) – Whethew the invite gwants tempowawy membewship (i.e. t-t-they get kicked aftew they disconnyect). Defauwts toFalse.unyique (
bool) – Whethew a unyique invite U-U-UWW shouwd be c-c-cweated. Defauwts t-toTrue. If this is set t-t-toFalsethen it wiww wetuwn a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The type of tawget fow the voice channyew invite, if any.
Nyew in v-v-vewsion 2.0.
tawget_usew (Optionyaw[
User]) –The usew whose stweam to dispway f-fow this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
t-tawget_appwication (Optionyaw[
Snowflake]) –The ID o-of the embedded appwication fow the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew in vewsion 2.0.
Changed i-i-in vewsion 2.9:
PartyTypeis depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The guiwd scheduwed event to incwude with the invite.
Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating this invite. Shows up on the audit wog.
- Waises:
HTTPException – Invite cweation faiwed.
NyotFound – The channyew that was passed is a categowy o-ow an invawid channyew.
- Wetuwns:
The nyewwy cweated invite.
- Wetuwn type:
- await delete(*, reason=None)[source]¶
This function is a cowoutinye.
Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to do this.- Pawametews:
weason (Optionyaw[
str]) – The weason fow deweting this channyew. Shows up on the audit wog.- Waises:
Fowbidden – You do nyot h-have pwopew pewmissions to dewete the channyew.
NyotFound – T-The channyew was nyot found ow was awweady deweted.
H-HTTPException – Deweting the channyew faiwed.
- await invites()[source]¶
This function i-is a cowoutinye.
Wetuwns a wist of aww active instant invites fwom this channyew.
You must have
Permissions.manage_channelspewmission to use this.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to get the infowmation.
HTTPException – An ewwow occuwwed whiwe fetching the infowmation.
- Wetuwns:
The wist o-o-of invites that awe cuwwentwy active.
- W-Wetuwn type:
Wist[
Invite]
- property jump_url[source]¶
A UWW t-t-that can be used to j-j-jump to this channyew.
Nyew in vewsion 2.4.
Nyote
This exists fow aww guiwd channyews but may nyot be usabwe by the cwient fow aww guiwd channyew types.
- property overwrites[source]¶
Wetuwns aww of t-t-the channyew’s uvwwwites.
T-T-This is wetuwnyed as a dictionyawy whewe the key contains the tawget which can be e-e-eithew a
Roleow a-a-aMemberand the vawue is the uvwwwite as a-a-aPermissionOverwrite.- Wetuwns:
The c-channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
Wetuwns t-the channyew-specific uvwwwites fow a membew ow a wowe.
- property permissions_synced[source]¶
Whethew ow nyot the pewmissions f-f-fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then this is
False.Nyew in vewsion 1.3.
- T-T-Type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
Sets the channyew specific pewmission uvwwwites fow a tawget in the channyew.
The
targetpawametew shouwd eithew be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyotingPermissionsattwibutes. If this is donye, then you cannyot mix the keywowd awguments with t-theoverwritepawametew.If the
overwritepawametew isNone, then t-the pewmission uvwwwites awe deweted.You must have
Permissions.manage_rolespewmission to do this.Nyote
This method wepwaces the owd uvwwwites with the onyes given.
Changed in vewsion 2.6: Waises
TypeErrorinstead o-o-ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – The membew ow wowe to uvwwwite pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – The pewmissions to awwow and d-d-deny to the tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument wist of pewmissions to set fow ease of use. Cannyot be mixed w-with
overwrite.weason (Optionyaw[
str]) – The weason fow doing this action. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit channyew specific pewmissions.
HTTPException – Editing channyew specific pewmissions f-faiwed.
NyotFound – The wowe ow membew being edited is nyot pawt of the guiwd.
TypeEwwow –
overwriteis invawid, the tawget type was n-nyotRoleowMember, both keywowd awguments andoverwritewewe pwovided, ow invawid pewmissions wewe pwovided as k-keywowd awguments.
Thwead¶
- appwied_tags
- awchive_timestamp
- awchived
- auto_awchive_duwation
- categowy
- categowy_id
- cweate_timestamp
- cweated_at
- fwags
- guiwd
- id
- invitabwe
- jump_uww
- wast_message
- wast_message_id
- wast_pin_timestamp
- w-w-wocked
- me
- membew_count
- membews
- mention
- message_count
- n-nyame
- ownyew
- ownyew_id
- pawent
- p-pawent_id
- swowmode_deway
- totaw_message_sent
- type
- asyncadd_tags
- asyncadd_usew
- asyncdewete
- asyncdewete_messages
- a-a-asyncedit
- asyncfetch_membew
- asyncfetch_membews
- asyncfetch_message
- defget_pawtiaw_message
- defhistowy
- defis_nyews
- defis_nsfw
- defis_pinnyed
- defis_pwivate
- asyncjoin
- asyncw-weave
- defpewmissions_fow
- asyncpins
- asyncpuwge
- a-a-asyncwemuv_tags
- asyncwemuv_usew
- asyncs-s-send
- asynctwiggew_typing
- deftyping
- class disnake.Thread[source]¶
Wepwesents a D-D-Discowd thwead.
- x == y
Checks if two thweads awe equaw.
- x != y
Checks if two thweads awe nyot equaw.
- hash(x)
W-Wetuwns the thwead’s hash.
- str(x)
Wetuwns the thwead’s nyame.
Nyew in vewsion 2.0.
- parent_id¶
The pawent
TextChannel,ForumChannel, owMediaChannelID this thwead bewongs to.- Type:
- last_message_id¶
The wast message ID of t-the message sent to t-this thwead. It may nyot point to an existing ow vawid message.
- T-Type:
Optionyaw[
int]
- slowmode_delay¶
The nyumbew of seconds a membew must wait between sending messages in this thwead. A vawue of 0 denyotes that it is disabwed. Bots, a-a-and usews with
manage_channelsowmanage_messages, b-b-bypass swowmode.- Type:
- message_count¶
An appwoximate n-n-nyumbew of messages in this thwead.
N-Nyote
If the thwead was cweated befowe Juwy 1, 2022, t-this couwd be inyaccuwate.
- Type:
Optionyaw[
int]
- member_count¶
A-An appwoximate nyumbew of membews in this thwead. This caps at 50.
- Type:
Optionyaw[
int]
- total_message_sent¶
The totaw nyumbew of m-messages sent i-in the t-thwead, incwuding deweted messages.
Nyew in vewsion 2.6.
Nyote
If the thwead was cweated befowe Juwy 1, 2022, this couwd be inyaccuwate.
- Type:
Optionyaw[
int]
- me¶
A thwead membew wepwesenting y-y-youwsewf, if you’ve joinyed the thwead. This couwd nyot be avaiwabwe.
- Type:
Optionyaw[
ThreadMember]
- invitable¶
Whethew nyon-modewatows can add othew nyon-modewatows to this thwead. This is awways
Truefow pubwic thweads.- Type:
- auto_archive_duration¶
The duwation in minyutes u-untiw the thwead is automaticawwy awchived due to inyactivity. Usuawwy a vawue of 60, 1440, 4320 and 10080.
- T-Type:
- archive_timestamp¶
An awawe timestamp of when the thwead’s awchived status was wast updated in UTC.
- Type:
- create_timestamp¶
An awawe timestamp of when the thwead was cweated in UTC. This i-is o-o-onwy avaiwabwe fow thweads cweated aftew 2022-01-09.
Nyew i-i-in vewsion 2.4.
- Type:
Optionyaw[
datetime.datetime]
- last_pin_timestamp¶
The time the most wecent message was pinnyed, ow
Noneif nyo message i-is cuwwentwy pinnyed.Nyew in vewsion 2.5.
- Type:
Optionyaw[
datetime.datetime]
- async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to use this.Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews a-awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in the channyew. Nyote, h-howevew, that this w-w-wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve m-m-messages aftew this date ow message. If a datetime is pwovided, it is wecommended to use a-a-a UTC awawe datetime. If the datetime is nyaive, it i-is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time. When u-u-using this awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
Fowbidden – You do nyot have pewmissions to get channyew message histowy.
HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– T-T-The message with the message data pawsed.
- async with typing()[source]¶
Wetuwns a-a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
This is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with this.Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property type[source]¶
The channyew’s Discowd type.
This awways wetuwns
ChannelType.public_thread,ChannelType.private_thread, owChannelType.news_thread.- Type:
- property parent[source]¶
The pawent channyew this thwead bewongs to.
- Type:
Optionyaw[Unyion[
TextChannel,ForumChannel,MediaChannel]]
- property members[source]¶
A wist of thwead membews i-i-in this thwead.
This wequiwes
Intents.membersto be pwopewwy fiwwed. Most of the time howevew, this data is n-n-nyot pwovided by the gateway and a caww tofetch_members()is nyeeded.- Type:
Wist[
ThreadMember]
- property last_message[source]¶
Gets the wast message in this channyew fwom the cache.
The message might nyot be vawid ow point to an existing message.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching t-t-the wast message, considew using e-eithew
history()owfetch_message()w-with thelast_message_idattwibute.- Wetuwns:
The wast message in this channyew ow
Noneif nyot found.- Wetuwn type:
Optionyaw[
Message]
- property category[source]¶
The categowy channyew the pawent channyew bewongs to, if appwicabwe.
- Waises:
CwientException – The pawent channyew was nyot cached and wetuwnyed
None.- Wetuwns:
The pawent channyew’s categowy.
- Wetuwn type:
O-O-Optionyaw[
CategoryChannel]
- property category_id[source]¶
The categowy channyew I-I-ID the pawent channyew b-b-bewongs to, if appwicabwe.
- Waises:
CwientException – The pawent channyew was nyot cached and wetuwnyed
None.- Wetuwns:
The pawent channyew’s categowy ID.
- Wetuwn type:
Optionyaw[
int]
- property created_at[source]¶
Wetuwns the thwead’s cweation time in UTC.
Changed in vewsion 2.4: If
create_timestampis pwovided by Discowd, that wiww be used instead of the time in the ID.- Type:
- is_private()[source]¶
Whethew the thwead is a pwivate thwead.
A pwivate thwead is onwy viewabwe by those that have been expwicitwy invited ow have
manage_threadspewmissions.- Wetuwn type:
- is_news()[source]¶
Whethew the thwead is a nyews thwead.
A nyews thwead is a thwead that has a pawent that is a nyews channyew, i.e.
TextChannel.is_news()isTrue.- Wetuwn t-t-type:
- is_nsfw()[source]¶
Whethew the thwead is NSFW ow nyot.
An NSFW thwead is a thwead that h-has a pawent that is an NSFW channyew, i.e.
TextChannel.is_nsfw()isTrue.- Wetuwn type:
- is_pinned()[source]¶
Whethew the thwead is pinnyed in a
ForumChannelo-owMediaChannel.Pinnyed thweads awe nyot affected by the auto awchive d-duwation.
This is a showtcut to
self.flags.pinned.N-Nyew in v-vewsion 2.5.
- Wetuwn type:
- property applied_tags[source]¶
The tags cuwwentwy appwied to this thwead. Onwy appwicabwe to thweads in channyews of type
ForumChannelowMediaChannel.Nyew in vewsion 2.6.
- Type:
Wist[
ForumTag]
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
H-H-Handwes pewmission wesowution fow the
MemberowRole.S-S-Since thweads do nyot have theiw own pewmissions, they inhewit them fwom the pawent channyew. Howevew, the pewmission context is diffewent compawed t-t-to a nyowmaw channyew, so this method has diffewent behaviow than cawwing the pawent’s
GuildChannel.permissions_formethod diwectwy.Nyote
If the thwead owiginyated fwom an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, t-t-this method wiww nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsinstead.Changed in vewsion 2.9: Pwopewwy takes
Permissions.send_messages_in_threadsinto considewation.- Pawametews:
o-o-obj (Unyion[
Member,Role]) – The object to wesowve pewmissions fow. This couwd be eithew a membew ow a wowe. If it’s a wowe then membew uvwwwites awe nyot computed.ignyowe_timeout (
bool) –Whethew ow nyot to ignyowe the usew’s timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This o-onwy appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed to
False.
- Waises:
CwientException – T-The pawent channyew was nyot cached and wetuwnyed
None- Wetuwns:
The wesowved pewmissions fow the membew o-ow wowe.
- Wetuwn type:
- await delete_messages(messages)[source]¶
This function is a cowoutinye.
Dewetes a wist of messages. This is simiwaw to
Message.delete()except it buwk dewetes muwtipwe messages.As a speciaw c-c-case, if the nyumbew of messages is 0, then nyothing is donye. If the nyumbew of messages is 1 then singwe message dewete is donye. If it’s mowe than two, then buwk dewete is used.
You cannyot buwk dewete mowe than 100 messages ow messages that awe owdew than 14 days owd.
Y-You must have the
manage_messagespewmission to use this.Usabwe onwy by bot accounts.
- Pawametews:
messages (Itewabwe[
abc.Snowflake]) – An itewabwe of messages denyoting which onyes to buwk dewete.- Waises:
CwientException – The nyumbew of messages to dewete was mowe than 100.
Fowbidden – You do nyot have pwopew pewmissions to dewete the messages ow you’we nyot using a bot account.
NyotFound – If singwe dewete, then the message was awweady d-deweted.
HTTPException – Deweting the messages faiwed.
- await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)[source]¶
This function is a cowoutinye.
Puwges a wist of messages that meet the cwitewia given by the pwedicate
check. If acheckis nyot pwovided then aww messages awe deweted without discwiminyation.You must have the
manage_messagespewmission to dewete messages even if they awe youw own (unwess you awe a usew account). Theread_message_historypewmission is awso nyeeded to wetwieve message h-histowy.Exampwes
Deweting b-b-bot’s messages
def is_me(m): return m.author == client.user deleted = await thread.purge(limit=100, check=is_me) await thread.send(f'Deleted {len(deleted)} message(s)')
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew o-o-of messages t-t-to seawch t-t-thwough. This is nyot the nyumbew of messages that wiww be deweted, though it can be.check (Cawwabwe[[
Message],bool]) – The function used to check if a message shouwd be deweted. It must take a-a-aMessageas its sowe pawametew.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same a-a-asbeforeinhistory().aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asafterinhistory().awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asaroundinhistory().o-owdest_fiwst (Optionyaw[
bool]) – Same asoldest_firstinhistory().buwk (
bool) – I-I-IfTrue, use buwk dewete. Setting this toFalseis usefuw fow mass-deweting a bot’s own messages withoutPermissions.manage_messages. WhenTrue, wiww faww back to singwe dewete if messages awe owdew than two weeks.
- Waises:
Fowbidden – You do nyot have pwopew pewmissions to do the actions wequiwed.
HTTPException – Puwging the messages faiwed.
- Wetuwns:
The wist of messages that wewe deweted.
- Wetuwn type:
Wist[
Message]
- await edit(*, name=..., archived=..., locked=..., invitable=..., slowmode_delay=..., auto_archive_duration=..., pinned=..., flags=..., applied_tags=..., reason=None)[source]¶
This function is a cowoutinye.
Edits the thwead.
Editing the thwead wequiwes
Permissions.manage_threads. The thwead cweatow can awso editname,archived,auto_archive_durationandapplied_tags. Nyote that i-i-if the thwead is wocked t-t-then onwy those withPermissions.manage_threadscan unyawchive a thwead.The thwead must be unyawchived to be edited.
- Pawametews:
nyame (
str) – The n-n-nyew nyame of the thwead.awchived (
bool) – Whethew to awchive t-t-the thwead ow nyot.wocked (
bool) – Whethew to wock the thwead ow nyot.invitabwe (
bool) – W-Whethew nyon-modewatows can add othew nyon-modewatows to this thwead. Onwy avaiwabwe fow pwivate thweads.auto_awchive_duwation (Unyion[
int,ThreadArchiveDuration]) – The nyew duwation in minyutes befowe a thwead i-is automaticawwy awchived fow inyactivity. Must be onye of60,1440,4320, ow10080.swowmode_deway (
int) – Specifies the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of0disabwes swowmode. The maximum vawue possibwe is21600.pinnyed (
bool) –Whethew to pin the thwead ow nyot. This is onwy avaiwabwe fow thweads cweated in a
ForumChannelowMediaChannel.Nyew in vewsion 2.5.
fwags (
ChannelFlags) –The n-nyew channyew fwags to set fow this thwead. This wiww uvwwwite any existing fwags set on this channyew. If pawametew
pinnedis pwovided, t-t-that wiww uvwwide the setting ofChannelFlags.pinned.Nyew in vewsion 2.6.
appwied_tags (Sequence[
abc.Snowflake]) –The nyew tags of the thwead. Maximum of 5. Can awso b-be used to weowdew existing tags.
T-T-This is onwy avaiwabwe fow thweads in a
ForumChannelowMediaChannel.If
moderatedtags awe edited,Permissions.manage_threadspewmissions awe wequiwed.See awso
add_tags()andremove_tags().Nyew in vewsion 2.6.
weason (Optionyaw[
str]) –The weason fow editing this thwead. Shows up on the audit wog.
Nyew in vewsion 2.5.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the thwead.
HTTPException – Editing the thwead faiwed.
- Wetuwns:
The nyewwy edited thwead.
- Wetuwn type:
- await join()[source]¶
This function is a-a-a cowoutinye.
Joins this thwead.
You must have
send_messages_in_threadsto join a thwead. If the thwead is pwivate,manage_threadsis awso nyeeded.- Waises:
Fowbidden – You do nyot have pewmissions to j-j-join the thwead.
HTTPException – Joinying the thwead faiwed.
- await leave()[source]¶
This function is a cowoutinye.
Weaves this thwead.
- W-Waises:
HTTPException – Weaving the thwead faiwed.
- await add_user(user)[source]¶
This function is a-a-a cowoutinye.
Adds a usew to this thwead.
You must have
send_messagespewmission to add a usew to a pubwic thwead. If the thwead is pwivate thensend_messagesand eithewcreate_private_threadsowmanage_messagespewmissions is wequiwed to add a u-usew to the thwead.- Pawametews:
usew (
abc.Snowflake) – The usew to add to the thwead.- Waises:
Fowbidden – You do nyot have p-p-pewmissions to add the usew to t-t-the thwead.
HTTPException – Adding the usew to the thwead faiwed.
- await remove_user(user)[source]¶
This function is a cowoutinye.
Wemuvs a usew fwom this thwead.
You must have
manage_threadso-ow be the cweatow of the thwead to wemuv a usew.- Pawametews:
usew (
abc.Snowflake) – The usew to wemuv f-fwom the thwead.- Waises:
Fowbidden – You do nyot have pewmissions to wemuv the usew fwom the thwead.
HTTPException – Wemoving t-t-the usew fwom the thwead faiwed.
- await fetch_member(member_id, /)[source]¶
This function is a cowoutinye.
Wetwieves a singwe
ThreadMemberfwom this thwead.- Pawametews:
membew_id (
int) – The I-ID of the membew to fetch.- Waises:
NyotFound – The specified membew was nyot found.
HTTPException – Wetwieving the membew faiwed.
- Wetuwns:
The thwead membew a-asked fow.
- Wetuwn type:
- await fetch_members()[source]¶
This function is a cowoutinye.
Wetwieves aww
ThreadMemberthat awe in this thwead.This wequiwes
Intents.membersto get infowmation about membews othew than youwsewf.- Waises:
HTTPException – Wetwieving t-the membews faiwed.
- Wetuwns:
Aww thwead membews in the t-t-thwead.
- Wetuwn type:
Wist[
ThreadMember]
- await delete(*, reason=None)[source]¶
This function i-is a cowoutinye.
Dewetes this thwead.
You must have
manage_threadsto dewete thweads. Awtewnyativewy, you may dewete a thwead if it’s in aForumChannelowMediaChannel, you awe the thwead cweatow, and thewe awe nyo messages othew than the inyitiaw message.- Pawametews:
weason (Optionyaw[
str]) –The weason fow deweting this thwead. Shows up on the audit wog.
Nyew i-in vewsion 2.5.
- Waises:
Fowbidden – You do nyot have pewmissions to dewete this thwead.
HTTPException – Deweting the thwead faiwed.
- await add_tags(*tags, reason=None)[source]¶
This function is a c-c-cowoutinye.
Adds the given tags to this thwead, up to 5 in totaw.
The thwead must be in a
ForumChannelowMediaChannel.Adding tags wequiwes you to have
Permissions.manage_threadspewmissions, ow be the ownyew of the thwead. Howevew, addingmoderatedtags awways wequiwesPermissions.manage_threadspewmissions.Nyew in vewsion 2.6.
- Pawametews:
*tags (
abc.Snowflake) – An awgument wist ofabc.Snowflakewepwesenting theForumTags to add to t-the thwead.weason (Optionyaw[
str]) – The weason fow editing this thwead. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmission to add these tags.
HTTPException – Editing the thwead faiwed.
- await remove_tags(*tags, reason=None)[source]¶
This function is a-a-a cowoutinye.
Wemuvs the given tags fwom this thwead.
The thwead must be in a
ForumChannelowMediaChannel.Wemoving tags wequiwes you to have
Permissions.manage_threadspewmissions, ow b-be the ownyew of the thwead. Howevew, wemovingmoderatedtags awways wequiwesPermissions.manage_threadspewmissions.Nyew in vewsion 2.6.
- Pawametews:
*tags (
abc.Snowflake) – An awgument wist ofabc.Snowflakewepwesenting theForumTags to wemuv fwom the thwead.weason (Optionyaw[
str]) – The weason f-f-fow editing this thwead. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmission to wemuv these tags.
HTTPException – E-E-Editing the thwead faiwed.
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom the message ID.This is usefuw if you want t-to wowk with a message a-a-and onwy have its ID without doing an unnyecessawy API caww.
Nyew in vewsion 2.0.
- Pawametews:
message_id (
int) – The message ID to cweate a pawtiaw message fow.- Wetuwns:
The pawtiaw message.
- Wetuwn t-type:
- await fetch_message(id, /)[source]¶
This function is a-a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message w-w-was nyot f-f-found.
Fowbidden – You do nyot have the p-pewmissions wequiwed to get a message.
HTTPException – Wetwieving the message faiwed.
- Wetuwns:
The message asked fow.
- Wetuwn type:
- await pins()[source]¶
This function is a cowoutinye.
Wetwieves aww messages that awe cuwwentwy pinnyed in the channyew.
Nyote
Due to a wimitation with the Discowd API, the
Messageobjects wetuwnyed by this method d-d-do nyot contain compweteMessage.reactionsdata.- Waises:
HTTPException – Wetwieving the pinnyed messages faiwed.
- Wetuwns:
The messages that a-a-awe cuwwentwy pinnyed.
- Wetuwn type:
Wist[
Message]
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function is a c-cowoutinye.
S-Sends a message to the destinyation with the content given.
The content must be a type that can convewt to a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filep-p-pawametew shouwd be used with a singweFileobject. To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying both pawametews wiww w-w-wead to an exception.To upwoad a singwe embed, the
embedp-pawametew shouwd be used with a singweEmbedobject. To upwoad muwtipwe embeds, theembedspawametew shouwd be used with alistofEmbedobjects. Specifying both pawametews wiww w-w-wead t-t-to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
c-c-content (Optionyaw[
str]) – The content of the m-m-message to send.tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.embeds (Wist[
Embed]) –A wist o-o-of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – The fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to u-upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of stickews to upwoad. Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy s-sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the nyumbew of seconds to wait in the backgwound befowe deweting the message we just sent. If the dewetion faiws, then i-i-it is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed at aww then the defauwts given byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to t-t-the
Messageto which you awe wepwying, this can b-b-be cweated usingMessage.to_reference()ow passed diwectwy as aMessage. You can c-contwow whethew this mentions the authow of the wefewenced message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to aMessageReferenceusingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. This cannyot be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v-v2 componyents hewe automaticawwy sets the
is_components_v2f-fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes t-thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in v-v-vewsion 2.9.
p-p-poww (
Poll) –The poww to s-s-send with t-the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the message f-f-faiwed.
Fowbidden – You do n-nyot have the pwopew pewmissions to send the message.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembedandembeds, ow you specified bothviewandcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is too wawge, ow you t-t-twied to send v2 componyents togethew withcontent,embeds,stickers, owpoll.
- W-W-Wetuwns:
The message that was sent.
- Wetuwn type:
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow aftew a-a message is sent.
ThweadMembew¶
- class disnake.ThreadMember[source]¶
Wepwesents a Discowd thwead membew.
- x == y
Checks if two thwead membews awe equaw.
- x != y
Checks if two thwead membews awe nyot equaw.
- hash(x)
Wetuwns the thwead membew’s hash.
- str(x)
Wetuwns the thwead membew’s nyame.
Nyew in vewsion 2.0.
- joined_at¶
The time the membew joinyed the thwead in UTC.
- Type:
StageChannyew¶
- bitwate
- categowy
- categowy_id
- changed_wowes
- cweated_at
- fwags
- g-guiwd
- id
- instance
- jump_uww
- w-wast_message
- wast_message_id
- wistenyews
- membews
- mention
- modewatows
- nyame
- nsfw
- uvwwwites
- pewmissions_synced
- position
- w-wequesting_to_speak
- wtc_wegion
- swowmode_deway
- speakews
- topic
- type
- usew_wimit
- video_quawity_mode
- voice_states
- asynccwonye
- asyncconnyect
- asynccweate_instance
- asynccweate_invite
- asynccweate_webhook
- asyncdewete
- asyncd-dewete_messages
- asyncedit
- asyncfetch_instance
- asyncfetch_message
- defget_pawtiaw_message
- defhistowy
- asyncinvites
- defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- asyncpuwge
- asyncsend
- asyncset_pewmissions
- asynctwiggew_typing
- deftyping
- asyncwebhooks
- class disnake.StageChannel[source]¶
Wepwesents a Discowd guiwd stage channyew.
Nyew in vewsion 1.7.
- x == y
Checks if two channyews awe equaw.
- x != y
Checks if two channyews a-awe nyot equaw.
- hash(x)
Wetuwns the channyew’s hash.
- str(x)
Wetuwns the channyew’s nyame.
- position¶
The position in t-t-the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.
- T-Type:
- rtc_region¶
The w-wegion fow the stage channyew’s voice communyication. A vawue of
Nonei-i-indicates automatic voice wegion detection.Changed in vewsion 2.5: Nyo wongew a
VoiceRegioninstance.- Type:
Optionyaw[
str]
- video_quality_mode¶
The camewa video quawity fow the stage channyew’s pawticipants.
Nyew in vewsion 2.0.
- Type:
- nsfw¶
Whethew the channyew i-is mawked as “nyot safe fow wowk”.
Nyote
To check i-if the channyew ow the guiwd of that channyew awe mawked as NSFW, considew
is_nsfw()instead.Nyew in vewsion 2.9.
- Type:
- slowmode_delay¶
The nyumbew of seconds a membew must wait between sending messages in this channyew. A vawue of 0 denyotes that it is disabwed. Bots, and usews with
manage_channelsowmanage_messages, bypass swowmode.Nyew in vewsion 2.9.
- Type:
- last_message_id¶
T-The wast message ID of the message sent to this channyew. It may nyot point to an existing ow vawid message.
Nyew in vewsion 2.9.
- Type:
Optionyaw[
int]
- property requesting_to_speak[source]¶
A-A wist of membews who awe wequesting to speak in the stage channyew.
- Type:
Wist[
Member]
- property speakers[source]¶
A wist of membews who have been pewmitted to speak in the stage channyew.
Nyew in vewsion 2.0.
- T-Type:
Wist[
Member]
- property listeners[source]¶
A wist o-of membews who awe wistenying in the stage channyew.
Nyew in vewsion 2.0.
- Type:
Wist[
Member]
- property moderators[source]¶
A wist of membews who awe modewating the stage channyew.
Nyew in vewsion 2.0.
- Type:
Wist[
Member]
- property type[source]¶
The channyew’s Discowd type.
This awways wetuwns
ChannelType.stage_voice.- T-Type:
- await clone(*, name=None, bitrate=..., position=..., category=..., slowmode_delay=..., rtc_region=..., video_quality_mode=..., nsfw=..., overwrites=..., reason=None)[source]¶
This f-function i-i-is a cowoutinye.
Cwonyes this channyew. This cweates a channyew with the same pwopewties as this channyew.
You must have
Permissions.manage_channelspewmission to do this.Changed in vewsion 2.9: Added
position,category,rtc_region,video_quality_mode,bitrate,nsfw,slowmode_delayandoverwriteskeywowd-onwy pawametews.Nyote
T-The cuwwent
StageChannel.flagsvawue won’t be cwonyed. This is a Discowd wimitation.Wawnying
Cuwwentwy the
user_limitattwibute is nyot cwonyed due to a Discowd wimitation. You can diwectwy edit the channyew aftew its cweation to set a usew_wimit.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the nyew channyew. If nyot pwovided, defauwts to this channyew’s nyame.bitwate (
int) – The bitwate of the nyew channyew. If nyot pwovided, defauwts to this channyew’s bitwate.position (
int) – The position of the nyew channyew. If nyot pwovided, defauwts to this channyew’s position.categowy (Optionyaw[
abc.Snowflake]) – The categowy whewe the nyew channyew shouwd be gwouped. If nyot pwovided, d-defauwts to this channyew’s categowy.swowmode_deway (
int) – The swowmode of the nyew channyew. If nyot pwovided, defauwts to this channyew’s swowmode.wtc_wegion (Optionyaw[Unyion[
str,VoiceRegion]]) – The wtc wegion of the nyew channyew. If nyot pwovided, defauwts to this channyew’s wtc wegion.video_quawity_mode (
VideoQualityMode) – The video quawity mode of the nyew channyew. If nyot pwovided, defauwts to this channyew’s video quawity m-mode.nsfw (
bool) – W-W-Whethew t-t-the nyew channyew shouwd be nsfw ow nyot. If nyot pwovided, defauwts to this channyew’s NSFW vawue.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a-a membew) toPermissionOverwriteto appwy to the channyew. If nyot pwovided, defauwts to this channyew’s uvwwwites.weason (Optionyaw[
str]) – The weason fow cwonying this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have the pwopew p-pewmissions to cweate this channyew.
HTTPException – Cweating the channyew faiwed.
- Wetuwns:
The channyew that was cweated.
- Wetuwn type:
- property last_message[source]¶
Gets the wast message in this channyew fwom the cache.
The message might nyot b-b-be vawid ow point to an existing message.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching the wast message, considew u-using eithew
history()owfetch_message()with thelast_message_idattwibute.Nyew in vewsion 2.9.
- Wetuwns:
The wast message in this channyew ow
Noneif nyot found.- Wetuwn type:
Optionyaw[
Message]
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom the given message ID.This is u-usefuw if you want to wowk with a message and onwy have its ID without doing an unnyecessawy API caww.
Nyew in vewsion 2.9.
- Pawametews:
message_id (
int) – The message ID to cweate a pawtiaw message f-f-fow.- Wetuwns:
The pawtiaw message object.
- Wetuwn t-type:
- property instance[source]¶
The w-w-wunnying stage instance of the stage channyew.
Nyew in vewsion 2.0.
- Type:
Optionyaw[
StageInstance]
- await create_instance(*, topic, privacy_level=..., notify_everyone=False, guild_scheduled_event=..., reason=None)[source]¶
This function is a cowoutinye.
Cweates a stage instance.
You must h-h-have
manage_channelspewmission to do this.Nyew in vewsion 2.0.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
topic (
str) – The stage instance’s topic.pwivacy_wevew (
StagePrivacyLevel) – The stage instance’s pwivacy wevew. Defauwts toStagePrivacyLevel.guild_only.nyotify_evewyonye (
bool) –Whethew to nyotify
@everyonethat the stage instance has stawted. Wequiwes themention_everyonepewmission on the stage channyew. Defauwts toFalse.Nyew in vewsion 2.5.
guiwd_scheduwed_event (
abc.Snowflake) –The guiwd scheduwed event associated with the stage instance. Setting this wiww automaticawwy stawt the event.
Nyew i-in vewsion 2.10.
weason (Optionyaw[
str]) – The weason the stage instance was cweated. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to cweate a stage instance.
HTTPException – Cweating a stage instance faiwed.
TypeEwwow – If the
privacy_levelpawametew is nyot the pwopew type.
- Wetuwns:
The nyewwy cweated stage instance.
- Wetuwn type:
- await fetch_instance()[source]¶
This function is a cowoutinye.
Wetwieves the wunnying
StageInstance.Nyew in vewsion 2.0.
- Waises:
N-N-NyotFound – T-T-The stage instance ow channyew couwd n-n-nyot be found.
HTTPException – Wetwieving the stage instance faiwed.
- Wetuwns:
The stage instance.
- Wetuwn type:
- await edit(*, name=..., bitrate=..., user_limit=..., position=..., sync_permissions=..., category=..., overwrites=..., rtc_region=..., video_quality_mode=..., nsfw=..., slowmode_delay=..., flags=..., reason=None, **kwargs)[source]¶
This function is a cowoutinye.
Edits the c-channyew.
You must have
manage_channelspewmission to do this.Changed in vewsion 2.0: The
topicpawametew must nyow b-b-be set viacreate_instance.Changed in vewsion 2.0: Edits awe n-n-nyo wongew in-pwace, the nyewwy edited channyew is wetuwnyed instead.
Changed in v-vewsion 2.6: W-Waises
TypeErrorowValueErrorinstead ofInvalidArgument.Changed in vewsion 2.9: T-The
user_limit,nsfw, andslowmode_delaykeywowd-onwy pawametews wewe added.- Pawametews:
nyame (
str) – The channyew’s n-nyew nyame.bitwate (
int) –The channyew’s nyew bitwate.
Nyew in v-vewsion 2.6.
usew_wimit (
int) –The channyew’s nyew usew wimit.
Nyew in vewsion 2.9.
position (
int) – The channyew’s nyew position.sync_pewmissions (
bool) – Whethew to sync pewmissions with the channyew’s nyew o-o-ow pwe-existing categowy. Defauwts toFalse.categowy (Optionyaw[
abc.Snowflake]) – The nyew categowy fow this channyew. Can beNoneto wemuv the categowy.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew.wtc_wegion (Optionyaw[Unyion[
str,VoiceRegion]]) – The nyew wegion fow the stage channyew’s voice communyication. A v-v-vawue ofNoneindicates automatic voice wegion detection.video_quawity_mode (
VideoQualityMode) –The camewa video quawity fow the stage channyew’s pawticipants.
Nyew in vewsion 2.9.
nsfw (
bool) –Whethew to mawk the channyew as N-N-NSFW.
Nyew i-in vewsion 2.9.
swowmode_deway (Optionyaw[
int]) –Specifies the swowmode wate wimit fow usews i-in this channyew, in seconds. A vawue of
0disabwes swowmode. The maximum vawue possibwe is21600.Nyew in vewsion 2.9.
fwags (
ChannelFlags) –The nyew f-fwags to s-s-set fow this channyew. This wiww uvwwwite any existing fwags set on this c-channyew.
Nyew in vewsion 2.6.
weason (Optionyaw[
str]) – The weason fow editing this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the channyew.
HTTPException – Editing the channyew faiwed.
TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.
VawueEwwow – The position is wess than 0.
- Wetuwns:
The nyewwy edited stage channyew. If the edit was onwy positionyaw then
Nonei-i-is wetuwnyed i-instead.- Wetuwn type:
Optionyaw[
StageChannel]
- await delete_messages(messages)[source]¶
This function is a cowoutinye.
Dewetes a w-wist of messages. This is simiwaw to
Message.delete()except it buwk dewetes muwtipwe messages.As a speciaw case, if the nyumbew of m-messages is 0, then nyothing is donye. If the nyumbew of messages is 1 t-t-then singwe message dewete i-is donye. If it’s mowe than two, then buwk dewete is u-used.
You cannyot buwk dewete mowe than 100 messages ow messages that awe owdew than 14 days.
You must have
manage_messagespewmission to do this.Nyew in vewsion 2.9.
- P-Pawametews:
messages (Itewabwe[
abc.Snowflake]) – An itewabwe of messages denyoting which onyes to buwk dewete.- Waises:
CwientException – The nyumbew of messages to dewete was mowe than 100.
Fowbidden – You do nyot h-h-have pwopew pewmissions to dewete the messages.
NyotFound – If singwe dewete, then the message was awweady deweted.
HTTPException – Deweting the messages faiwed.
- await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)[source]¶
This function i-is a cowoutinye.
Puwges a wist of m-messages that meet the cwitewia given by the pwedicate
check. If achecki-is nyot pwovided then aww messages a-a-awe deweted without discwiminyation.You must have
manage_messagespewmission to dewete messages even if they awe youw own.read_message_historypewmission is awso nyeeded to wetwieve message histowy.Nyew in vewsion 2.9.
Nyote
See
TextChannel.purge()fow exampwes.- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to s-s-seawch thwough. This is nyot t-the nyumbew of messages that wiww be deweted, though it can be.check (Cawwabwe[[
Message],bool]) – The function used to check if a-a-a message shouwd be deweted. It must take aMessageas its sowe pawametew.b-befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asbeforeinhistory().a-a-aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asafterinhistory().awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Same asaroundinhistory().owdest_fiwst (Optionyaw[
bool]) – Same asoldest_firsti-inhistory().b-buwk (
bool) – IfTrue, use buwk dewete. Setting this toFalseis usefuw fow mass-deweting a bot’s own messages withoutPermissions.manage_messages. WhenTrue, wiww faww back to singwe dewete if messages awe owdew than two w-weeks.
- W-Waises:
Fowbidden – You do nyot have pwopew pewmissions to do the actions w-w-wequiwed.
HTTPException – Puwging the messages faiwed.
- Wetuwns:
A wist of messages that wewe deweted.
- Wetuwn type:
Wist[
Message]
- await webhooks()[source]¶
This function is a cowoutinye.
Wetwieves the wist of webhooks this channyew has.
You must have
manage_webhookspewmission to use this.Nyew in vewsion 2.9.
- Waises:
F-F-Fowbidden – You don’t have pewmissions to get the webhooks.
- Wetuwns:
The wist of webhooks this channyew has.
- Wetuwn type:
Wist[
Webhook]
- await create_webhook(*, name, avatar=None, reason=None)[source]¶
This function is a cowoutinye.
Cweates a webhook fow this channyew.
You must have
manage_webhookspewmission to do this.Nyew in vewsion 2.9.
- Pawametews:
- Waises:
NyotFound – The
avatarasset couwdn’t be found.Fowbidden – You do nyot have pewmissions to cweate a-a webhook.
HTTPException – Cweating the webhook faiwed.
TypeEwwow – The
avatarasset is a wottie stickew (seeSticker.read()).
- W-W-Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- property category[source]¶
The categowy this channyew bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist o-o-of wowes that have been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- T-T-Type:
Wist[
Role]
- await connect(*, timeout=60.0, reconnect=True, cls=<class 'disnake.voice_client.VoiceClient'>)[source]¶
This f-function i-i-is a cowoutinye.
Connyects to voice and c-c-cweates a
VoiceClientto estabwish youw connyection to the voice sewvew.This wequiwes
Intents.voice_states.- Pawametews:
timeout (
float) – The timeout in seconds to w-wait f-fow the voice endpoint.weconnyect (
bool) – Whethew the bot shouwd automaticawwy attempt a weconnyect if a pawt of the handshake faiws ow the gateway goes d-down.cws (Type[
VoiceProtocol]) – A type that s-s-subcwassesVoiceProtocolto connyect with. Defauwts toVoiceClient.
- Waises:
asyncio.TimeoutEwwow – Couwd nyot connyect to the voice channyew i-in time.
C-C-CwientException – You awe awweady connyected to a voice channyew.
opus.OpusNyotWoaded – The opus wibwawy has nyot been woaded.
- Wetuwns:
A voice cwient that i-is fuwwy connyected to the voice sewvew.
- Wetuwn type:
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
This function is a cowoutinye.
Cweates an instant invite fwom a text ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- Pawametews:
max_age (
int) – How wong the invite s-shouwd wast in seconds. If set to0, then the invite doesn’t expiwe. Defauwts to0.max_uses (
int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe u-unwimited uses. Defauwts to0.tempowawy (
bool) – W-W-Whethew the invite gwants tempowawy membewship (i.e. they get kicked a-a-aftew they disconnyect). Defauwts t-t-toFalse.unyique (
bool) – Whethew a-a unyique invite UWW shouwd be c-cweated. Defauwts toTrue. If this is set toFalsethen it wiww wetuwn a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The t-type of tawget fow the voice channyew invite, if any.
Nyew in vewsion 2.0.
tawget_usew (Optionyaw[
User]) –The usew whose stweam to dispway fow this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
tawget_appwication (Optionyaw[
Snowflake]) –The I-ID of t-t-the embedded appwication fow t-t-the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew in vewsion 2.0.
Changed i-in vewsion 2.9:
PartyTypeis depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The guiwd scheduwed event to incwude with the invite.
Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating this invite. Shows up on the audit wog.
- Waises:
H-H-HTTPException – Invite cweation faiwed.
NyotFound – The channyew that was passed is a categowy ow an invawid channyew.
- Wetuwns:
The nyewwy cweated invite.
- Wetuwn type:
- await delete(*, reason=None)[source]¶
This f-function is a cowoutinye.
Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to do this.- Pawametews:
weason (Optionyaw[
str]) – The weason fow deweting this channyew. Shows up on t-the audit wog.- Waises:
Fowbidden – You do nyot have pwopew pewmissions t-t-to dewete the channyew.
NyotFound – The channyew was nyot found ow was awweady deweted.
HTTPException – Deweting the channyew faiwed.
- await fetch_message(id, /)[source]¶
This function is a-a-a cowoutinye.
Wetwieves a singwe
Messagefwom t-t-the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message was nyot found.
Fowbidden – You do nyot have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving the message faiwed.
- Wetuwns:
The message asked fow.
- Wetuwn type:
- history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to use t-this.Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy m-m-message in the channyew. Nyote, h-howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime i-is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages aftew this date ow message. If a datetime is pwovided, it is wecommended to use a-a-a U-UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – W-Wetwieve messages awound this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, i-i-it is assumed to be wocaw time. When u-using this awgument, the maximum w-w-wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at most wimit + 1 messages.owdest_fiwst (O-Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
Fowbidden – You do nyot have pewmissions to get channyew message histowy.
HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– The message with the message data pawsed.
- await invites()[source]¶
This function is a cowoutinye.
Wetuwns a wist of aww active instant invites fwom this channyew.
You must have
Permissions.manage_channelspewmission to use this.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to get t-t-the infowmation.
HTTPException – An ewwow occuwwed whiwe fetching the i-infowmation.
- Wetuwns:
The wist of invites that awe cuwwentwy active.
- Wetuwn type:
Wist[
Invite]
- property jump_url[source]¶
A UWW that can be used to jump to this channyew.
Nyew i-in vewsion 2.4.
Nyote
This exists fow aww guiwd channyews but may nyot b-be u-u-usabwe by the cwient fow aww guiwd channyew types.
- property members[source]¶
Wetuwns aww membews that awe c-c-cuwwentwy inside this voice channyew.
- Type:
Wist[
Member]
- await move(**kwargs)[source]¶
This function is a cowoutinye.
A wich intewface to hewp muv a channyew wewative t-to othew channyews.
If exact position muvment is wequiwed,
editshouwd be used instead.You must have
Permissions.manage_channelspewmission to do this.Nyote
Voice channyews wiww awways be sowted bewow text channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
beginnying (
bool) – Whethew to muv the channyew to t-t-the beginnying of the channyew wist (ow categowy if given). This is mutuawwy excwusive withend,before, andafter.end (
bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy i-i-if given). This i-is mutuawwy excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The channyew that shouwd b-be befowe ouw cuwwent channyew. This is mutuawwy excwusive w-withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andbefore.offset (
int) – The n-n-nyumbew of channyews to offset t-t-the muv by. Fow e-exampwe, an offset of2withbeginning=Truewouwd muv it 2 aftew the beginnying. A-A-A positive nyumbew muvs it bewow whiwe a nyegative nyumbew muvs it a-a-abuv. Nyote that this nyumbew is wewative and computed aftew thebeginning,end,before, andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to muv this channyew undew. IfNoneis given then it muvs it out of the categowy. This pawametew is i-i-ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync the pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The weason fow moving this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions t-to muv the channyew.
HTTPException – Moving the channyew faiwed.
T-T-TypeEwwow – A bad m-m-mix of awguments wewe passed.
VawueEwwow – An invawid position was given.
- property overwrites[source]¶
Wetuwns aww of the channyew’s uvwwwites.
This is wetuwnyed as a dictionyawy whewe the key contains the tawget which can be eithew a
Roleow aMemberand the vawue is the uvwwwite as aPermissionOverwrite.- Wetuwns:
The channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
W-Wetuwns the channyew-specific uvwwwites fow a membew ow a wowe.
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes pewmission wesowution fow the
MemberowRole.This function takes into considewation the fowwowing cases:
Guiwd ownyew
Guiwd wowes
C-C-Channyew uvwwides
Membew uvwwides
Timeouts
If a
Roleis passed, then it checks the pewmissions someonye with that wowe wouwd have, which is essentiawwy:The defauwt wowe p-pewmissions
The pewmissions of the w-w-wowe used as a pawametew
The defauwt wowe pewmission uvwwwites
The pewmission uvwwwites of the wowe used as a pawametew
Nyote
If the channyew owiginyated fwom a-a-an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed a-appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsinstead.Changed in vewsion 2.0: The object passed in can nyow be a wowe object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object t-t-to wesowve pewmissions fow. This couwd be eithew a membew o-o-ow a wowe. If it’s a-a wowe then membew uvwwwites awe nyot computed.ignyowe_timeout (
bool) –Whethew ow n-nyot to ignyowe the usew’s timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This onwy appwies to
Memberobjects.Changed in vewsion 2.6: The d-d-defauwt was changed to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The w-wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- property permissions_synced[source]¶
Whethew ow n-nyot the pewmissions fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then this is
False.Nyew in vewsion 1.3.
- Type:
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function i-i-is a cowoutinye.
Sends a m-message to the destinyation with the content given.
The content must be a type that can convewt to a stwing thwough
str(content).At weast o-o-onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filepawametew shouwd be used with a singweFileobject. To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying both pawametews wiww wead to a-a-an exception.To upwoad a singwe embed, the
embedpawametew s-shouwd be used with a singweEmbedobject. To upwoad muwtipwe embeds, t-theembedspawametew shouwd be used with alistofEmbedobjects. Specifying both pawametews wiww wead to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.tts (
bool) – Whethew t-t-the m-message s-shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.embeds (Wist[
Embed]) –A-A wist of e-e-embeds to send with the content. Must be a m-maximum of 10. This cannyot b-be mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – The fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist o-o-of stickews to upwoad. Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the nyumbew of seconds to wait in the backgwound befowe deweting the message we just sent. If the dewetion faiws, then it i-is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging b-b-behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to t-the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed at aww then the defauwts given byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to the
Messageto which you awe wepwying, this can be cweated usingMessage.to_reference()ow passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to aMessageReferenceu-usingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. T-T-This cannyot be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A w-wist of componyents to incwude in the message. This cannyot be m-m-mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, a-a-andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set to
True.Nyew i-i-in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
poww (
Poll) –The poww to send with the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have t-t-the pwopew pewmissions to send the message.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembedandembeds, ow you specified bothviewa-andcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is too wawge, ow you twied to send v2 c-componyents togethew w-w-withcontent,embeds,stickers, owpoll.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
Sets the channyew s-specific pewmission uvwwwites fow a tawget in the channyew.
T-T-The
targetpawametew s-s-shouwd eithew be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass i-i-in keywowd awguments denyotingPermissionsattwibutes. If this is donye, then you cannyot mix the keywowd awguments with theoverwritepawametew.If the
overwritep-pawametew isNone, then the pewmission uvwwwites awe deweted.You must have
Permissions.manage_rolespewmission to do t-this.Nyote
This method wepwaces the owd uvwwwites with the onyes given.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – The membew ow wowe to uvwwwite pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – The p-p-pewmissions to awwow and deny to t-t-the tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument wist of pewmissions to set fow ease of use. Cannyot be mixed with
overwrite.weason (Optionyaw[
str]) – The weason fow doing this action. Shows up on the audit wog.
- Waises:
Fowbidden – You do n-nyot have pewmissions to edit channyew specific pewmissions.
HTTPException – Editing channyew specific pewmissions faiwed.
NyotFound – The wowe ow membew being edited is nyot pawt of the guiwd.
TypeEwwow –
overwriteis invawid, the tawget type was nyotRoleowMember, both k-keywowd awguments andoverwritewewe pwovided, ow invawid pewmissions wewe pwovided as keywowd awguments.
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow a-a-aftew a m-message is sent.
- typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow a-an indefinyite pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
This is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with t-t-this.E-Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property voice_states[source]¶
Wetuwns a mapping of membew IDs who have voice states i-i-in this channyew.
Nyew in vewsion 1.3.
Nyote
This function is intentionyawwy wow wevew to wepwace
memberswhen the membew cache is unyavaiwabwe.- Wetuwns:
T-The mapping of membew ID to a v-voice state.
- Wetuwn type:
Mapping[
int,VoiceState]
FowumChannyew¶
- avaiwabwe_tags
- c-categowy
- categowy_id
- changed_wowes
- cweated_at
- defauwt_auto_awchive_duwation
- defauwt_wayout
- defauwt_weaction
- defauwt_sowt_owdew
- defauwt_thwead_swowmode_deway
- fwags
- guiwd
- id
- jump_uww
- wast_thwead
- wast_thwead_id
- membews
- mention
- nyame
- nsfw
- uvwwwites
- pewmissions_synced
- position
- swowmode_deway
- thweads
- topic
- type
- defawchived_thweads
- asynccwonye
- asynccweate_invite
- a-asynccweate_thwead
- asynccweate_webhook
- asyncdewete
- asyncedit
- defget_tag
- defget_tag_by_nyame
- defget_thwead
- asyncinvites
- defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- defwequiwes_tag
- asyncset_pewmissions
- asynctwiggew_typing
- deftyping
- asyncwebhooks
- class disnake.ForumChannel[source]¶
Wepwesents a Discowd guiwd fowum channyew.
Nyew in vewsion 2.5.
- x == y
Checks if two channyews awe equaw.
- x != y
Checks if two channyews awe nyot equaw.
- hash(x)
Wetuwns the channyew’s hash.
- str(x)
Wetuwns the channyew’s nyame.
- category_id¶
The categowy channyew ID this channyew bewongs to, i-i-if appwicabwe.
- Type:
Optionyaw[
int]
- position¶
The p-p-position in the channyew wist. This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.
- Type:
- nsfw¶
Whethew the channyew is mawked as “nyot safe fow wowk”.
Nyote
To check if the channyew ow t-the guiwd of that channyew awe mawked as NSFW, considew
is_nsfw()instead.- Type:
- last_thread_id¶
The ID of the wast c-cweated thwead in this c-c-channyew. It may nyot point to an existing ow vawid thwead.
- Type:
Optionyaw[
int]
- default_auto_archive_duration¶
The defauwt auto awchive duwation i-i-in minyutes fow thweads cweated in t-this channyew.
- Type:
- slowmode_delay¶
The nyumbew of seconds a membew must wait between cweating thweads in this channyew.
A vawue of
0denyotes that it is disabwed. Bots, and usews withmanage_channelsowmanage_messages, bypass swowmode.See awso
default_thread_slowmode_delay.- Type:
- default_thread_slowmode_delay¶
The defauwt nyumbew of seconds a membew must wait between sending m-m-messages in nyewwy cweated thweads in this channyew.
A vawue of
0denyotes that it is disabwed. Bots, and usews withmanage_channelsowmanage_messages, bypass swowmode.Nyew in vewsion 2.6.
- Type:
- default_sort_order¶
The defauwt sowt owdew of thweads in this channyew. Membews wiww stiww be abwe to c-c-change this wocawwy.
Nyew in vewsion 2.6.
- Type:
Optionyaw[
ThreadSortOrder]
- default_layout¶
The defauwt wayout of thweads in this channyew. Membews wiww stiww be abwe to change this wocawwy.
Nyew in vewsion 2.8.
- Type:
- async with typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
N-Nyote
This is both a weguwaw context manyagew and an async c-context manyagew. This means that both
withandasync withwowk with this.E-E-Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property type[source]¶
The channyew’s Discowd type.
This awways wetuwns
ChannelType.forum.- Type:
- await edit(*, name=..., topic=..., position=..., nsfw=..., sync_permissions=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., overwrites=..., flags=..., require_tag=..., available_tags=..., default_reaction=..., default_sort_order=..., default_layout=..., reason=None, **kwargs)[source]¶
This function is a cowoutinye.
Edits the channyew.
You must have
manage_channelspewmission to do this.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The channyew’s nyew nyame.topic (Optionyaw[
str]) – The channyew’s nyew topic.position (
int) – The channyew’s nyew position.nsfw (
bool) – Whethew to mawk the channyew as NSFW.sync_pewmissions (
bool) – Whethew to sync pewmissions with the channyew’s nyew ow pwe-existing categowy. Defauwts toFalse.categowy (Optionyaw[
abc.Snowflake]) – The nyew c-c-categowy fow this channyew. Can beNoneto wemuv the categowy.swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit at which usews can cweate thweads in this channyew, in seconds. A vawue of0owNonedisabwes swowmode. The maximum vawue possibwe is21600.defauwt_thwead_swowmode_deway (Optionyaw[
int]) –Specifies the swowmode wate wimit at which usews can send messages in nyewwy cweated thweads in this channyew, in seconds. This does nyot appwy wetwoactivewy to existing thweads. A vawue of
0owNonedisabwes swowmode. The maximum vawue possibwe is21600.Nyew in vewsion 2.6.
uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) t-toPermissionOverwriteto appwy to the channyew.defauwt_auto_awchive_duwation (O-Optionyaw[Unyion[
int,ThreadArchiveDuration]]) – The nyew defauwt auto awchive duwation in minyutes fow t-t-thweads cweated in this channyew. Must be onye of60,1440,4320, ow10080.fwags (
ChannelFlags) –The nyew fwags to set fow this channyew. This wiww uvwwwite any existing fwags set on this channyew. If pawametew
require_tagis pwovided, that wiww uvwwide the setting ofChannelFlags.require_tag.Nyew in vewsion 2.6.
wequiwe_tag (
bool) –Whethew aww nyewwy c-c-cweated thweads awe wequiwed to have a tag.
Nyew in v-v-vewsion 2.6.
avaiwabwe_tags (Sequence[
ForumTag]) –The nyew
ForumTags avaiwabwe fow thweads in this channyew. Can be used to cweate nyew tags and e-edit/weowdew/dewete existing tags. Maximum of 20.Nyote t-that this uvwwwites aww tags, wemoving existing tags unwess they’we passed as weww.
See
ForumTagfow exampwes wegawding cweating/editing tags.Nyew in vewsion 2.6.
defauwt_weaction (Optionyaw[Unyion[
str,Emoji,PartialEmoji]]) –The nyew defauwt emoji shown fow weacting to thweads.
Nyew in vewsion 2.6.
defauwt_sowt_owdew (Optionyaw[
ThreadSortOrder]) –The nyew defauwt sowt owdew of thweads in this channyew.
Nyew in vewsion 2.6.
defauwt_wayout (
ThreadLayout) –The nyew defauwt wayout of thweads in this c-c-channyew.
N-N-Nyew in vewsion 2.8.
weason (Optionyaw[
str]) – The weason fow editing this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit the channyew.
HTTPException – Editing the channyew faiwed.
TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.
VawueEwwow – The position is wess than 0.
- Wetuwns:
The n-n-nyewwy e-e-edited fowum channyew. If the edit was onwy positionyaw then
Noneis wetuwnyed instead.- Wetuwn type:
Optionyaw[
ForumChannel]
- await clone(*, name=None, topic=..., position=..., nsfw=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., available_tags=..., default_reaction=..., default_sort_order=..., default_layout=..., overwrites=..., reason=None)[source]¶
This function is a-a cowoutinye.
Cwonyes this channyew. This cweates a channyew w-with the same pwopewties as this channyew.
You m-m-must h-h-have
Permissions.manage_channelspewmission to do this.Changed in vewsion 2.9: Added nyew
topic,position,nsfw,category,slowmode_delay,default_thread_slowmode_delay,default_auto_archive_duration,available_tags,default_reaction,default_sort_orderandoverwriteskeywowd-onwy pawametews.Changed in vewsion 2.10: Added
default_layoutpawametew.Nyote
The cuwwent
ForumChannel.flagsvawue won’t be cwonyed. This is a Discowd wimitation.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the n-nyew channyew. If nyot pwovided, defauwts to this c-c-channyew’s nyame.topic (Optionyaw[
str]) – The topic of the nyew channyew. If nyot pwovided, defauwts to this channyew’s topic.position (
int) – The position of the nyew channyew. If nyot pwovided, defauwts to this channyew’s position.nsfw (
bool) – Whethew the nyew channyew shouwd b-be nsfw ow nyot. If nyot pwovided, defauwts to this channyew’s NSFW vawue.categowy (Optionyaw[
abc.Snowflake]) – The categowy whewe the nyew c-c-channyew shouwd be gwouped. If nyot pwovided, defauwts to this channyew’s categowy.swowmode_deway (Optionyaw[
int]) – The swowmode deway of the nyew channyew. If nyot pwovided, defauwts to this channyew’s swowmode deway.defauwt_thwead_swowmode_deway (Optionyaw[
int]) – The defauwt thwead swowmode deway of the nyew channyew. If n-n-nyot pwovided, defauwts to this c-channyew’s defauwt thwead swowmode deway.defauwt_auto_awchive_duwation (Optionyaw[Unyion[
int,ThreadArchiveDuration]]) – The defauwt auto a-a-awchive duwation of the nyew c-channyew. If nyot pwovided, defauwts to this channyew’s d-defauwt auto awchive duwation.avaiwabwe_tags (Sequence[
ForumTag]) – The appwicabwe tags of the nyew channyew. If nyot pwovided, defauwts to this channyew’s avaiwabwe tags.defauwt_weaction (Optionyaw[Unyion[
str,Emoji,PartialEmoji]]) – The defauwt weaction of the nyew channyew. If nyot pwovided, d-defauwts to this channyew’s defauwt weaction.defauwt_sowt_owdew (Optionyaw[
ThreadSortOrder]) – The defauwt sowt owdew o-of the nyew channyew. If nyot pwovided, defauwts to this channyew’s d-d-defauwt sowt owdew.defauwt_wayout (
ThreadLayout) – The defauwt wayout of thweads in t-t-the nyew channyew. If nyot pwovided, defauwts to this channyew’s defauwt wayout.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew. If nyot pwovided, defauwts t-t-to this channyew’s uvwwwites.w-weason (Optionyaw[
str]) – The weason fow cwonying this channyew. Shows up on the a-a-audit wog.
- Waises:
F-Fowbidden – You do nyot have the pwopew pewmissions to cweate this channyew.
HTTPException – Cweating the channyew faiwed.
- Wetuwns:
The channyew that was cweated.
- Wetuwn type:
- archived_threads(*, limit=50, before=None)[source]¶
Wetuwns an
AsyncIteratorthat itewates uvw aww awchived thweads in the channyew.You must have
read_message_historypewmission to use this.- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of thweads t-to wetwieve. IfNone, wetwieves evewy awchived thwead in the channyew. Nyote, h-howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve awchived channyews befowe t-t-the given date ow ID.
- W-W-Waises:
Fowbidden – You do nyot have pewmissions to get awchived thweads.
HTTPException – The wequest to get the awchived thweads faiwed.
- Yiewds:
Thread– T-T-The awchived thweads.
- property available_tags[source]¶
The a-a-avaiwabwe tags fow thweads in this channyew.
To cweate/edit/dewete tags, use
edit().Nyew in vewsion 2.6.
- Type:
Wist[
ForumTag]
- property category[source]¶
The categowy this channyew bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist of wowes that have b-b-been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- Type:
Wist[
Role]
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
T-T-This function is a cowoutinye.
Cweates an instant invite fwom a text ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- Pawametews:
max_age (
int) – How wong the invite s-s-shouwd wast in seconds. If set to0, then the invite doesn’t expiwe. Defauwts t-to0.max_uses (
int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts to0.tempowawy (
bool) – Whethew the invite gwants t-t-tempowawy membewship (i.e. they get kicked aftew they disconnyect). Defauwts toFalse.unyique (
bool) – W-Whethew a unyique invite UWW s-s-shouwd be cweated. Defauwts toTrue. If this is set toFalsethen it wiww wetuwn a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The type o-of tawget fow the voice channyew invite, if a-any.
Nyew in vewsion 2.0.
tawget_usew (Optionyaw[
User]) –T-The usew whose stweam to d-d-dispway fow this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
tawget_appwication (Optionyaw[
Snowflake]) –T-T-The ID of the embedded appwication fow the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew in vewsion 2.0.
Changed in vewsion 2.9:
PartyTypeis depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The guiwd scheduwed event to incwude with the invite.
Nyew in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow cweating this invite. Shows up on the audit wog.
- Waises:
H-HTTPException – Invite cweation faiwed.
NyotFound – The channyew that was passed is a categowy ow an invawid channyew.
- Wetuwns:
The nyewwy cweated invite.
- Wetuwn type:
- await create_thread(*, name, auto_archive_duration=..., slowmode_delay=..., applied_tags=..., content=..., embed=..., embeds=..., file=..., files=..., suppress_embeds=..., flags=..., stickers=..., allowed_mentions=..., view=..., components=..., reason=None)[source]¶
This function is a cowoutinye.
C-Cweates a thwead (with an inyitiaw m-m-message) in this channyew.
Y-You must have the
create_forum_threadspewmission to do this.At w-weast onye of
content,embed/embeds,file/files,stickers,components, owviewmust be pwovided.Changed i-in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.Changed in vewsion 2.6: The
contentp-pawametew is nyo wongew w-w-wequiwed.Nyote
Unwike
TextChannel.create_thread(), this wetuwns a tupwe with both the cweated thwead and message.- Pawametews:
nyame (
str) – The nyame of the thwead.auto_awchive_duwation (Unyion[
int,ThreadArchiveDuration]) – The d-duwation in minyutes befowe the thwead is automaticawwy awchived fow inyactivity. If nyot pwovided, the channyew’s defauwt auto awchive duwation is used. Must be onye o-o-of60,1440,4320, ow10080.swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of0disabwes swowmode. The maximum vawue possibwe is21600. If set toNoneow nyot pwovided, swowmode is inhewited fwom the pawent’sdefault_thread_slowmode_delay.appwied_tags (Sequence[
abc.Snowflake]) –The tags to appwy to the nyew thwead. Maximum of 5.
Nyew in vewsion 2.6.
content (
str) – The content of the message to send.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.embeds (Wist[
Embed]) – A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with theembedpawametew.suppwess_embeds (
bool) – Whethew to suppwess embeds f-f-fow the message. This hides aww the embeds fwom the UI if set toTrue.fwags (
MessageFlags) –The fwags to set f-fow this message. Onwy
suppress_embedsandis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
fiwe (
File) – The fiwe to upwoad. This c-c-cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A w-w-wist of fiwes t-to upwoad. Must b-be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) – A wist of stickews to u-u-upwoad. Must be a maximum of 3.awwowed_mentions (
AllowedMentions) – Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged withClient.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed at aww then the defauwts given byClient.allowed_mentionsawe used instead.view (
ui.View) – A Discowd UI View to add to the message. This cannyot be mixed withcomponents.componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist of componyents to incwude in the m-m-message. This cannyot be mixed with
view.Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds, andstickersfiewds.weason (Optionyaw[
str]) – The weason fow cweating the thwead. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to c-c-cweate a thwead.
HTTPException – Stawting the thwead faiwed.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembedandembeds, ow you specified b-b-bothviewandcomponents, ow you have passed an object that is nyotFiletofileowfiles.VawueEwwow – Specified mowe than 10 embeds, ow mowe than 10 fiwes, ow you twied to send v2 c-componyents togethew with
content,embeds, owstickers.
- Wetuwns:
A-A
NamedTuplewith the nyewwy cweated thwead and the message sent in it.- Wetuwn type:
- await create_webhook(*, name, avatar=None, reason=None)[source]¶
This function is a cowoutinye.
Cweates a webhook fow this channyew.
You must have
manage_webhookspewmission to do this.Nyew in vewsion 2.6.
- Pawametews:
- Waises:
NyotFound – The
avatara-a-asset couwdn’t be found.Fowbidden – You do nyot have pewmissions to cweate a webhook.
HTTPException – Cweating the webhook faiwed.
TypeEwwow – The
avatarasset is a wottie stickew (seeSticker.read()).
- Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- property default_reaction[source]¶
Optionyaw[Unyion[
Emoji,PartialEmoji]]: The defauwt emoji shown fow weacting to thweads.Due t-to a Discowd w-wimitation, this wiww have an empty
nameif it is a customPartialEmoji.Nyew in vewsion 2.6.
- await delete(*, reason=None)[source]¶
This function i-is a cowoutinye.
Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to do this.- Pawametews:
weason (Optionyaw[
str]) – The weason f-fow d-deweting this channyew. Shows up on the audit wog.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to dewete t-the c-channyew.
NyotFound – The channyew was nyot found ow was awweady deweted.
HTTPException – Deweting the channyew faiwed.
- get_tag_by_name(name, /)[source]¶
Wetuwns a thwead tag with the given nyame.
Tags can be unyiquewy identified based on the nyame, a-as tag nyames in a channyew must be unyique.
Nyew in vewsion 2.6.
- await invites()[source]¶
T-This function is a-a-a c-c-cowoutinye.
Wetuwns a wist of aww active instant invites fwom t-this channyew.
You must h-h-have
Permissions.manage_channelspewmission to use this.- Waises:
Fowbidden – You do nyot have pwopew p-pewmissions to get the infowmation.
H-HTTPException – An ewwow occuwwed w-whiwe fetching the infowmation.
- Wetuwns:
The wist of invites that awe cuwwentwy active.
- Wetuwn type:
Wist[
Invite]
- property jump_url[source]¶
A UWW that can be u-u-used to jump to this channyew.
Nyew in vewsion 2.4.
Nyote
This exists fow aww guiwd channyews but may nyot be usabwe by the cwient fow aww guiwd channyew types.
- property last_thread[source]¶
Gets the wast cweated thwead in this channyew fwom t-t-the cache.
The thwead might nyot be vawid ow point to an existing thwead.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching the wast thwead, use
Guild.fetch_channel()with thelast_thread_idattwibute.- Wetuwns:
The wast cweated thwead in this channyew ow
Noneif nyot found.- Wetuwn type:
Optionyaw[
Thread]
- await move(**kwargs)[source]¶
This function is a-a cowoutinye.
A wich intewface to hewp muv a channyew wewative to othew channyews.
I-If e-e-exact position muvment is wequiwed,
editshouwd be used instead.You must have
Permissions.manage_channelspewmission to do this.Nyote
Voice channyews w-w-wiww awways be sowted bewow text c-channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
beginnying (
bool) – Whethew t-to muv the channyew to the beginnying of the channyew wist (ow c-categowy if given). This is mutuawwy excwusive withend,before, andafter.end (
bool) – Whethew to m-muv the channyew to the e-e-end of the channyew w-w-wist (ow categowy if given). This is mutuawwy excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The channyew that shouwd b-b-be befowe ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew that shouwd be a-aftew ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andbefore.offset (
int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset o-o-of2w-w-withbeginning=Truewouwd muv it 2 aftew the beginnying. A positive nyumbew muvs it bewow whiwe a nyegative nyumbew muvs it abuv. Nyote that this nyumbew is w-wewative and c-c-computed aftew thebeginning,end,before, a-a-andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to muv this channyew undew. IfNoneis given then i-it muvs it out of the categowy. This pawametew is ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync t-the p-pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The weason fow moving this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to muv the channyew.
HTTPException – Moving the channyew faiwed.
TypeEwwow – A bad mix of awguments wewe passed.
VawueEwwow – An invawid position was given.
- property overwrites[source]¶
Wetuwns aww of the channyew’s uvwwwites.
This is wetuwnyed as a dictionyawy whewe the key contains the tawget which can be eithew a
Roleow aMemberand the vawue is the uvwwwite as aPermissionOverwrite.- Wetuwns:
The channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
Wetuwns the channyew-specific u-u-uvwwwites fow a membew ow a wowe.
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes pewmission wesowution fow the
MemberowRole.This function takes into considewation the fowwowing cases:
Guiwd ownyew
Guiwd wowes
Channyew uvwwides
Membew uvwwides
Timeouts
I-If a
Roleis passed, then it checks the pewmissions someonye with that wowe wouwd have, which is essentiawwy:The defauwt wowe pewmissions
The pewmissions of the wowe used as a-a-a pawametew
The defauwt wowe pewmission uvwwwites
The p-p-pewmission uvwwwites of the wowe used as a pawametew
Nyote
If the channyew owiginyated fwom an
Interactionand theguildattwibute is u-unyavaiwabwe, such as w-w-with usew-instawwed a-a-appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew u-usingInteraction.permissionsowapp_permissionsinstead.Changed in vewsion 2.0: The object p-p-passed in can nyow be a wowe object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object to wesowve pewmissions fow. This couwd be e-eithew a membew ow a wowe. If it’s a wowe then membew uvwwwites awe nyot computed.ignyowe_timeout (
bool) –Whethew ow nyot to ignyowe the usew’s t-timeout. Defauwts to
False.Nyew in vewsion 2.4.
Nyote
This onwy appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- property permissions_synced[source]¶
Whethew ow nyot the pewmissions fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then this is
False.Nyew in vewsion 1.3.
- Type:
- requires_tag()[source]¶
Whethew aww nyewwy cweated thweads in this channyew awe wequiwed to have a tag.
This is a showtcut to
self.flags.require_tag.Nyew in vewsion 2.6.
- Wetuwn type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
S-Sets the channyew specific pewmission uvwwwites fow a tawget in the channyew.
The
targetpawametew shouwd eithew b-b-be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyotingPermissionsattwibutes. If this is donye, then you cannyot mix the keywowd awguments with theoverwritepawametew.If the
overwritepawametew isNone, then the pewmission uvwwwites awe deweted.You must have
Permissions.manage_rolespewmission to do this.Nyote
This method wepwaces the owd u-uvwwwites with the onyes given.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – The membew ow wowe to u-uvwwwite pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – The p-p-pewmissions to awwow and deny to the t-t-tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument w-w-wist of pewmissions to set fow ease of use. Cannyot be mixed with
overwrite.w-w-weason (Optionyaw[
str]) – The weason fow doing this action. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to edit channyew specific pewmissions.
HTTPException – Editing channyew specific pewmissions faiwed.
NyotFound – The wowe ow membew being edited is nyot pawt of the guiwd.
T-T-TypeEwwow –
overwriteis invawid, the tawget type was nyotRoleowMember, both k-keywowd awguments andoverwritewewe pwovided, ow invawid pewmissions wewe pwovided as keywowd awguments.
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the desinyation.
Typing indicatow wiww go away aftew 10 seconds.
- await webhooks()[source]¶
This function is a cowoutinye.
Wetwieves the wist o-o-of webhooks this channyew has.
You must have
manage_webhookspewmission to use this.Nyew in vewsion 2.6.
MediaChannyew¶
- avaiwabwe_tags
- categowy
- categowy_id
- changed_wowes
- cweated_at
- defauwt_auto_awchive_duwation
- defauwt_weaction
- defauwt_sowt_owdew
- defauwt_thwead_swowmode_deway
- fwags
- guiwd
- id
- jump_uww
- wast_thwead
- wast_thwead_id
- membews
- mention
- nyame
- nsfw
- uvwwwites
- pewmissions_synced
- position
- swowmode_deway
- thweads
- topic
- type
- defawchived_thweads
- asynccwonye
- asynccweate_invite
- asynccweate_thwead
- asynccweate_webhook
- asyncdewete
- asyncedit
- d-d-defget_tag
- defget_tag_by_nyame
- defget_thwead
- defhides_media_downwoad_options
- asyncinvites
- defis_nsfw
- asyncmuv
- defuvwwwites_fow
- defpewmissions_fow
- defwequiwes_tag
- asyncset_pewmissions
- asynctwiggew_typing
- deftyping
- asyncwebhooks
- class disnake.MediaChannel[source]¶
Wepwesents a Discowd g-g-guiwd media channyew.
Media channyews awe vewy simiwaw to fowum channyews - onwy thweads can be cweated in them, with o-onwy minyow diffewences in functionyawity.
Nyew in vewsion 2.10.
- x == y
Checks if two channyews a-a-awe equaw.
- x != y
C-Checks if two c-c-channyews awe nyot equaw.
- hash(x)
Wetuwns t-t-the channyew’s hash.
- str(x)
Wetuwns the channyew’s nyame.
- position¶
The position in t-the channyew wist. T-This is a nyumbew that stawts at 0. e.g. the top channyew is position 0.
- Type:
- nsfw¶
Whethew the channyew is mawked as “nyot safe fow wowk”.
Nyote
To check if the channyew ow the guiwd of that channyew awe mawked as NSFW, considew
is_nsfw()instead.- Type:
- last_thread_id¶
The ID of the wast cweated thwead in this channyew. It may nyot point to an existing ow vawid thwead.
- Type:
Optionyaw[
int]
- default_auto_archive_duration¶
The defauwt auto awchive duwation in minyutes fow thweads c-cweated in t-this c-channyew.
- Type:
- slowmode_delay¶
The nyumbew of seconds a membew must wait between cweating thweads in this channyew.
A-A-A vawue of
0denyotes that it is disabwed. Bots, a-and usews withmanage_channelsowmanage_messages, b-bypass swowmode.See awso
default_thread_slowmode_delay.- Type:
- default_thread_slowmode_delay¶
The defauwt nyumbew of seconds a membew must wait between sending messages in nyewwy cweated thweads in this channyew.
A v-vawue of
0denyotes that it is disabwed. Bots, and usews withmanage_channelsowmanage_messages, bypass swowmode.- T-Type:
- default_sort_order¶
The defauwt sowt o-o-owdew of thweads in this channyew. Membews wiww s-stiww be abwe to change this wocawwy.
- Type:
Optionyaw[
ThreadSortOrder]
- async with typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite p-pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
T-This is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with this.Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property type[source]¶
The channyew’s Discowd type.
This awways wetuwns
ChannelType.media.- Type:
- hides_media_download_options()[source]¶
Whethew the channyew hides the embedded media downwoad options.
This is a showtcut t-t-to
self.flags.hide_media_download_options.- Wetuwn type:
- await edit(*, name=..., topic=..., position=..., nsfw=..., sync_permissions=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., overwrites=..., flags=..., require_tag=..., available_tags=..., default_reaction=..., default_sort_order=..., reason=None, **kwargs)[source]¶
This function is a c-c-cowoutinye.
Edits the channyew.
You must h-have
manage_channelspewmission to do this.- Pawametews:
nyame (
str) – The channyew’s nyew nyame.topic (Optionyaw[
str]) – The channyew’s nyew topic.position (
int) – The channyew’s nyew position.nsfw (
bool) – W-W-Whethew to mawk the channyew as NSFW.sync_pewmissions (
bool) – Whethew to sync pewmissions with t-the c-c-channyew’s nyew o-o-ow pwe-existing categowy. Defauwts toFalse.categowy (Optionyaw[
abc.Snowflake]) – The nyew categowy f-f-fow this channyew. Can beNoneto wemuv the categowy.swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit at w-which usews can cweate thweads in this channyew, in seconds. A vawue of0owNonedisabwes s-swowmode. The maximum vawue possibwe is21600.defauwt_thwead_swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit at which usews can send messages in nyewwy cweated thweads in this c-c-channyew, in seconds. This does nyot appwy wetwoactivewy to existing thweads. A vawue of0owNonedisabwes swowmode. The maximum vawue possibwe is21600.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe ow a membew) toPermissionOverwriteto appwy to the channyew.defauwt_auto_awchive_duwation (Optionyaw[Unyion[
int,ThreadArchiveDuration]]) – The nyew d-d-defauwt auto awchive duwation i-in m-m-minyutes fow thweads cweated in this channyew. Must be o-o-onye of60,1440,4320, ow10080.fwags (
ChannelFlags) – The nyew fwags to set fow this channyew. This wiww uvwwwite any existing fwags set on this channyew. If pawametewrequire_tagis pwovided, that wiww uvwwide the setting ofChannelFlags.require_tag.wequiwe_tag (
bool) – Whethew aww nyewwy cweated thweads a-a-awe wequiwed to have a t-t-tag.avaiwabwe_tags (Sequence[
ForumTag]) –The n-n-nyew
ForumTags avaiwabwe fow thweads in this channyew. Can be used to cweate nyew tags and edit/weowdew/dewete existing tags. Maximum of 20.Nyote t-t-that this uvwwwites aww tags, wemoving existing t-t-tags unwess they’we passed as weww.
See
ForumTagfow exampwes wegawding cweating/editing tags.defauwt_weaction (Optionyaw[Unyion[
str,Emoji,PartialEmoji]]) – The nyew defauwt emoji shown fow weacting to thweads.defauwt_sowt_owdew (Optionyaw[
ThreadSortOrder]) – The nyew defauwt sowt owdew of thweads in this channyew.weason (Optionyaw[
str]) – The weason fow editing this channyew. Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have p-p-pewmissions to edit the channyew.
HTTPException – Editing the channyew faiwed.
TypeEwwow – The pewmission uvwwwite infowmation is nyot in pwopew fowm.
VawueEwwow – The position is wess than 0.
- Wetuwns:
The nyewwy edited media channyew. If the edit was onwy positionyaw then
Nonei-is w-w-wetuwnyed i-i-instead.- Wetuwn type:
Optionyaw[
MediaChannel]
- await clone(*, name=None, topic=..., position=..., nsfw=..., category=..., slowmode_delay=..., default_thread_slowmode_delay=..., default_auto_archive_duration=..., available_tags=..., default_reaction=..., default_sort_order=..., overwrites=..., reason=None)[source]¶
This function is a cowoutinye.
Cwonyes this channyew. This cweates a channyew with the same pwopewties as this channyew.
Y-Y-You must have
Permissions.manage_channelspewmission to do this.Nyote
The c-c-cuwwent
MediaChannel.flagsvawue won’t be cwonyed. This is a Discowd wimitation.- Pawametews:
nyame (Optionyaw[
str]) – The nyame of the nyew channyew. If nyot pwovided, defauwts to this channyew’s nyame.topic (Optionyaw[
str]) – The topic of the nyew channyew. If nyot pwovided, defauwts to this channyew’s topic.position (
int) – The position o-of the nyew channyew. If nyot pwovided, defauwts to this channyew’s position.nsfw (
bool) – Whethew the nyew channyew s-s-shouwd be nsfw ow nyot. If nyot pwovided, defauwts to this channyew’s NSFW vawue.categowy (Optionyaw[
abc.Snowflake]) – The categowy whewe the nyew channyew shouwd be gwouped. If nyot p-p-pwovided, defauwts to this channyew’s categowy.swowmode_deway (Optionyaw[
int]) – The swowmode deway of t-t-the nyew channyew. If nyot pwovided, defauwts to this channyew’s swowmode deway.defauwt_thwead_swowmode_deway (Optionyaw[
int]) – The defauwt thwead swowmode deway of the nyew channyew. If nyot pwovided, defauwts to this channyew’s defauwt thwead swowmode deway.defauwt_auto_awchive_duwation (Optionyaw[Unyion[
int,ThreadArchiveDuration]]) – The defauwt auto awchive duwation of the nyew channyew. If nyot pwovided, defauwts to this channyew’s defauwt auto awchive duwation.avaiwabwe_tags (Sequence[
ForumTag]) – The appwicabwe tags of the nyew channyew. If nyot pwovided, defauwts to this channyew’s avaiwabwe tags.defauwt_weaction (Optionyaw[Unyion[
str,Emoji,PartialEmoji]]) – The defauwt weaction o-of the nyew channyew. If nyot pwovided, defauwts to this c-channyew’s defauwt weaction.defauwt_sowt_owdew (O-O-Optionyaw[
ThreadSortOrder]) – The defauwt sowt owdew of the nyew channyew. If n-nyot pwovided, defauwts to this channyew’s defauwt sowt owdew.uvwwwites (
Mapping) – AMappingof tawget (eithew a wowe o-o-ow a membew) toPermissionOverwriteto appwy to t-the channyew. If nyot pwovided, defauwts to this channyew’s uvwwwites.weason (Optionyaw[
str]) – The weason fow cwonying 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.
- W-Wetuwns:
The channyew t-t-that was cweated.
- Wetuwn type:
- archived_threads(*, limit=50, before=None)[source]¶
W-Wetuwns an
AsyncIteratorthat itewates uvw a-aww awchived thweads in the channyew.You must h-h-have
read_message_historypewmission to use this.- Pawametews:
w-w-wimit (Optionyaw[
int]) – The nyumbew of thweads to wetwieve. IfNone, wetwieves evewy awchived thwead in the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (O-Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve awchived channyews befowe the given date ow ID.
- Waises:
Fowbidden – You do nyot have pewmissions to get a-awchived thweads.
HTTPException – The wequest to get the awchived thweads faiwed.
- Yiewds:
Thread– The awchived thweads.
- property available_tags[source]¶
The avaiwabwe tags fow thweads in this channyew.
To cweate/edit/dewete tags, use
edit().Nyew in vewsion 2.6.
- Type:
Wist[
ForumTag]
- property category[source]¶
The categowy this channyew bewongs to.
If thewe is nyo categowy then this is
None.- Type:
Optionyaw[
CategoryChannel]
- property changed_roles[source]¶
Wetuwns a wist of wowes that have been uvwwidden fwom theiw defauwt vawues in the
Guild.rolesattwibute.- Type:
Wist[
Role]
- await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application=None, guild_scheduled_event=None)[source]¶
This f-f-function is a cowoutinye.
Cweates an i-i-instant invite fwom a text o-o-ow voice channyew.
You must have
Permissions.create_instant_invitepewmission to do this.- P-Pawametews:
max_age (
int) – How wong the invite shouwd wast in seconds. If set to0, then the invite doesn’t expiwe. Defauwts to0.max_uses (
int) – H-H-How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts to0.tempowawy (
bool) – Whethew the invite gwants tempowawy m-membewship (i.e. they get kicked aftew they disconnyect). Defauwts toFalse.unyique (
bool) – Whethew a unyique invite UWW shouwd be cweated. Defauwts toTrue. If this is set toFalsethen i-it wiww wetuwn a pweviouswy cweated invite.tawget_type (Optionyaw[
InviteTarget]) –The type of tawget fow the voice channyew invite, if any.
Nyew in vewsion 2.0.
tawget_usew (Optionyaw[
User]) –The usew whose stweam t-to dispway fow this invite, wequiwed if
target_typeisInviteTarget.stream. The usew must be stweaming in the channyew.Nyew in vewsion 2.0.
tawget_appwication (Optionyaw[
Snowflake]) –The ID of the embedded appwication fow the invite, wequiwed if
target_typeisInviteTarget.embedded_application.Nyew in vewsion 2.0.
Changed in vewsion 2.9:
PartyTypei-is depwecated, andSnowflakeshouwd be used instead.guiwd_scheduwed_event (Optionyaw[
GuildScheduledEvent]) –The guiwd scheduwed event to incwude with t-t-the i-i-invite.
Nyew i-in vewsion 2.3.
weason (Optionyaw[
str]) – The weason fow c-c-cweating this invite. Shows up on the audit wog.
- Waises:
HTTPException – Invite cweation faiwed.
NyotFound – The channyew that was p-p-passed is a categowy ow an invawid channyew.
- Wetuwns:
The nyewwy cweated invite.
- Wetuwn type:
- await create_thread(*, name, auto_archive_duration=..., slowmode_delay=..., applied_tags=..., content=..., embed=..., embeds=..., file=..., files=..., suppress_embeds=..., flags=..., stickers=..., allowed_mentions=..., view=..., components=..., reason=None)[source]¶
This function is a-a-a cowoutinye.
Cweates a thwead (with an inyitiaw message) in this channyew.
You must have the
create_forum_threadspewmission to do this.At weast onye of
content,embed/embeds,file/files,stickers,components, owviewmust be p-p-pwovided.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.Changed in vewsion 2.6: The
contentpawametew is nyo wongew w-wequiwed.Nyote
Unwike
TextChannel.create_thread(), this wetuwns a-a tupwe with both t-t-the cweated thwead and message.- Pawametews:
nyame (
str) – The nyame of the thwead.auto_awchive_duwation (U-U-Unyion[
int,ThreadArchiveDuration]) – The duwation in minyutes befowe the thwead is automaticawwy awchived fow inyactivity. If nyot pwovided, the c-channyew’s defauwt auto awchive duwation is used. Must be onye of60,1440,4320, ow10080.swowmode_deway (Optionyaw[
int]) – Specifies the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of0disabwes swowmode. The maximum vawue possibwe is21600. If set toNoneow nyot pwovided, swowmode is inhewited fwom the pawent’sdefault_thread_slowmode_delay.appwied_tags (Sequence[
abc.Snowflake]) –The tags to appwy to t-the nyew thwead. Maximum of 5.
Nyew in vewsion 2.6.
content (
str) – The content of the message to send.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.e-embeds (Wist[
Embed]) – A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with theembedpawametew.suppwess_embeds (
bool) – Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set toTrue.fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embedsandis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
fiwe (
File) – The fiwe to upwoad. This cannyot b-b-be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) – A wist of stickews to upwoad. Must be a maximum of 3.awwowed_mentions (
AllowedMentions) – Contwows the mentions being pwocessed in this message. If this i-i-is passed, then t-the object is mewged withClient.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo o-object is passed at aww then the defauwts given byClient.allowed_mentionsawe used instead.view (
ui.View) – A Discowd UI V-V-View to add to the message. This cannyot be mixed withcomponents.componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist of componyents to incwude in t-the message. This cannyot be mixed with
view.Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds, andstickersfiewds.w-w-weason (Optionyaw[
str]) – The weason fow cweating the thwead. Shows up on the audit wog.
- W-Waises:
Fowbidden – You do nyot h-h-have pewmissions to cweate a thwead.
HTTPException – Stawting t-t-the thwead faiwed.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembeda-andembeds, ow you specified bothviewandcomponents, ow you have passed an object that i-is nyotFiletofileowfiles.VawueEwwow – Specified mowe than 10 embeds, ow mowe than 10 fiwes, ow you twied to send v2 componyents togethew with
content,embeds, owstickers.
- Wetuwns:
A
NamedTuplewith the nyewwy cweated thwead and the message sent in it.- Wetuwn type:
- await create_webhook(*, name, avatar=None, reason=None)[source]¶
This function is a cowoutinye.
Cweates a-a-a webhook f-f-fow this channyew.
You must have
manage_webhookspewmission to do this.Nyew in vewsion 2.6.
- P-Pawametews:
- Waises:
NyotFound – The
avatarasset couwdn’t be found.Fowbidden – You do nyot have pewmissions to cweate a webhook.
HTTPException – Cweating the webhook faiwed.
TypeEwwow – The
avatarasset is a wottie stickew (seeSticker.read()).
- Wetuwns:
The nyewwy cweated webhook.
- Wetuwn type:
- property default_reaction[source]¶
Optionyaw[Unyion[
Emoji,PartialEmoji]]: The defauwt emoji shown fow weacting to thweads.Due to a Discowd wimitation, this wiww have an empty
nameif it is a customPartialEmoji.N-N-Nyew in vewsion 2.6.
- await delete(*, reason=None)[source]¶
This function is a cowoutinye.
Dewetes the channyew.
You must have
Permissions.manage_channelspewmission to d-d-do this.- Pawametews:
weason (Optionyaw[
str]) – The weason fow deweting this channyew. Shows up on the audit wog.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to dewete t-t-the channyew.
NyotFound – The c-channyew was nyot found ow was awweady deweted.
HTTPException – Deweting t-t-the channyew faiwed.
- get_tag_by_name(name, /)[source]¶
Wetuwns a thwead t-t-tag with the given nyame.
Tags can be unyiquewy i-i-identified based on the nyame, as tag nyames in a channyew must be unyique.
Nyew in vewsion 2.6.
- await invites()[source]¶
This function is a cowoutinye.
Wetuwns a wist of aww active instant invites fwom this channyew.
You must have
Permissions.manage_channelspewmission to use t-this.- Waises:
Fowbidden – You do nyot have pwopew pewmissions t-to get the infowmation.
HTTPException – An ewwow occuwwed whiwe fetching the infowmation.
- Wetuwns:
The wist of invites that awe c-cuwwentwy active.
- Wetuwn type:
Wist[
Invite]
- property jump_url[source]¶
A UWW that can be used to jump to this channyew.
Nyew i-i-in vewsion 2.4.
Nyote
This exists fow aww guiwd channyews but may n-n-nyot be usabwe b-by the cwient fow aww guiwd channyew types.
- property last_thread[source]¶
Gets the wast cweated t-thwead in this channyew fwom the cache.
The thwead might nyot b-b-be vawid ow p-p-point to an existing thwead.
Wewiabwe Fetching
Fow a swightwy mowe wewiabwe method of fetching the wast thwead, use
Guild.fetch_channel()with thelast_thread_idattwibute.- Wetuwns:
The wast cweated thwead in this channyew ow
Nonei-if nyot found.- Wetuwn type:
Optionyaw[
Thread]
- await move(**kwargs)[source]¶
This function is a cowoutinye.
A wich intewface to hewp muv a c-c-channyew wewative to othew channyews.
If exact position muvment is wequiwed,
editshouwd be used instead.You must have
Permissions.manage_channelspewmission to do this.Nyote
Voice channyews wiww awways be sowted bewow text channyews. This is a Discowd wimitation.
Nyew in vewsion 1.7.
Changed i-i-in v-v-vewsion 2.6: Waises
TypeErroro-o-owValueErrorinstead ofInvalidArgument.- Pawametews:
beginnying (
bool) – Whethew to muv the channyew to the beginnying of the channyew wist (ow c-c-categowy if given). This is mutuawwy e-e-excwusive withend,before, andafter.end (
bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This is mutuawwy e-excwusive withbeginning,before, andafter.befowe (
abc.Snowflake) – The c-channyew that shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andafter.aftew (
abc.Snowflake) – The channyew that s-shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive withbeginning,end, andbefore.offset (
int) – The nyumbew of c-channyews t-t-to offset the muv b-b-by. Fow exampwe, an offset of2withbeginning=Truewouwd muv it 2 aftew the beginnying. A positive nyumbew muvs it bewow whiwe a nyegative nyumbew muvs it abuv. Nyote that this nyumbew is wewative and computed aftew thebeginning,end,before, andafterpawametews.categowy (Optionyaw[
abc.Snowflake]) – The categowy to muv this channyew undew. IfNoneis given then it muvs it out of the categowy. This pawametew is ignyowed if moving a categowy channyew.sync_pewmissions (
bool) – Whethew to sync the pewmissions with the categowy (if given).weason (Optionyaw[
str]) – The weason fow moving this channyew. S-S-Shows up on the audit wog.
- Waises:
Fowbidden – You do nyot have pewmissions to muv the channyew.
HTTPException – Moving the channyew faiwed.
TypeEwwow – A bad mix of a-awguments wewe passed.
VawueEwwow – An invawid position was given.
- property overwrites[source]¶
Wetuwns aww of the channyew’s uvwwwites.
This is wetuwnyed as a dictionyawy w-whewe the key contains the tawget which can be eithew a
Roleo-o-ow aMemberand the vawue is the uvwwwite as aPermissionOverwrite.- Wetuwns:
The channyew’s pewmission uvwwwites.
- Wetuwn type:
Dict[Unyion[
Role,Member],PermissionOverwrite]
- overwrites_for(obj)[source]¶
Wetuwns the channyew-specific uvwwwites fow a membew ow a wowe.
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes pewmission wesowution fow the
MemberowRole.This function takes into considewation the fowwowing cases:
Guiwd ownyew
Guiwd wowes
Channyew uvwwides
Membew uvwwides
Timeouts
If a-a
Roleis passed, then it checks the pewmissions someonye with that wowe wouwd have, which is essentiawwy:The defauwt wowe pewmissions
The p-p-pewmissions o-o-of t-t-the wowe used as a pawametew
The defauwt wowe pewmission uvwwwites
T-The pewmission uvwwwites of the wowe used as a pawametew
Nyote
If the channyew owiginyated fwom an
Interactionand theguildattwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww n-n-nyot wowk due to an API wimitation. Considew usingInteraction.permissionsowapp_permissionsinstead.Changed in vewsion 2.0: The object passed in can nyow be a wowe o-object.
- Pawametews:
obj (Unyion[
Member,Role]) – The object to wesowve pewmissions fow. This couwd be eithew a membew ow a wowe. If it’s a wowe then membew u-uvwwwites awe nyot computed.ignyowe_timeout (
bool) –Whethew ow nyot to ignyowe the usew’s timeout. Defauwts to
False.Nyew i-i-in vewsion 2.4.
Nyote
This onwy appwies to
Memberobjects.Changed in vewsion 2.6: The defauwt was changed to
False.
- Waises:
TypeEwwow –
ignore_timeoutis onwy suppowted fowMemberobjects.- Wetuwns:
The wesowved pewmissions fow the membew ow wowe.
- Wetuwn type:
- property permissions_synced[source]¶
Whethew ow nyot the pewmissions fow this channyew awe synced with the categowy it bewongs to.
If thewe is nyo categowy then t-t-this i-i-is
False.Nyew in vewsion 1.3.
- Type:
- requires_tag()[source]¶
Whethew aww nyewwy c-c-cweated thweads in this channyew awe wequiwed to have a tag.
This is a showtcut to
self.flags.require_tag.Nyew in vewsion 2.6.
- Wetuwn type:
- await set_permissions(target, *, overwrite=..., reason=None, **permissions)[source]¶
This function is a cowoutinye.
Sets the channyew specific pewmission uvwwwites f-fow a tawget in the channyew.
The
targetpawametew shouwd eithew be aMemberow aRolethat bewongs to guiwd.The
overwritepawametew, if given, must eithew beNoneowPermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyotingPermissionsattwibutes. If this is donye, then you cannyot mix the keywowd a-a-awguments with theoverwritepawametew.If the
overwritepawametew i-isNone, then the pewmission uvwwwites awe deweted.You must have
Permissions.manage_rolespewmission to do this.Nyote
This method wepwaces t-the owd uvwwwites with the onyes given.
Changed i-i-in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.Exampwes
Setting awwow and deny:
await message.channel.set_permissions(message.author, view_channel=True, send_messages=False)
Deweting uvwwwites
await channel.set_permissions(member, overwrite=None)
Using
PermissionOverwriteoverwrite = disnake.PermissionOverwrite() overwrite.send_messages = False overwrite.view_channel = True await channel.set_permissions(member, overwrite=overwrite)
- Pawametews:
tawget (Unyion[
Member,Role]) – T-T-The membew ow wowe to uvwwwite pewmissions fow.uvwwwite (Optionyaw[
PermissionOverwrite]) – The pewmissions to awwow and deny to the tawget, owNoneto dewete the uvwwwite.**pewmissions – A keywowd awgument wist of pewmissions to set fow ease of use. Cannyot be mixed with
overwrite.weason (Optionyaw[
str]) – T-T-The weason fow doing this action. Shows up on the audit w-wog.
- W-W-Waises:
Fowbidden – You do nyot have pewmissions to edit channyew specific pewmissions.
HTTPException – Editing channyew specific pewmissions faiwed.
N-NyotFound – The wowe ow membew b-being edited is nyot pawt of the guiwd.
TypeEwwow –
overwriteis i-i-invawid, the tawget type was nyotRoleowMember, both keywowd awguments andoverwritewewe pwovided, ow invawid pewmissions w-w-wewe pwovided as keywowd a-a-awguments.
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the desinyation.
Typing indicatow wiww go away aftew 10 seconds.
- await webhooks()[source]¶
This function is a cowoutinye.
Wetwieves the wist of webhooks this channyew has.
You must have
manage_webhookspewmission to use this.Nyew in vewsion 2.6.
DMChannyew¶
- asyncfetch_message
- defget_pawtiaw_message
- defhistowy
- defpewmissions_fow
- asyncpins
- asyncsend
- asynctwiggew_typing
- deftyping
- class disnake.DMChannel[source]¶
Wepwesents a Discowd d-diwect message channyew.
- x == y
Checks if two channyews awe equaw.
- x != y
Checks if two channyews awe nyot equaw.
- hash(x)
Wetuwns the channyew’s hash.
- str(x)
Wetuwns a stwing wepwesentation of the channyew
- recipient¶
The usew you a-a-awe pawticipating with in the diwect message channyew. If this channyew is weceived thwough the g-gateway, t-the wecipient infowmation may nyot be awways avaiwabwe.
- Type:
Optionyaw[
User]
- me¶
The usew pwesenting youwsewf.
- Type:
- last_pin_timestamp¶
The time the most wecent message was pinnyed, ow
Noneif nyo message is c-cuwwentwy pinnyed.Nyew in vewsion 2.5.
- Type:
Optionyaw[
datetime.datetime]
- async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to u-u-use this.E-E-Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in t-t-the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow message. If a datetime is pwovided, it is wecommended to use a U-UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages aftew this date ow message. If a datetime is pwovided, it is wecommended to use a-a UTC a-awawe datetime. If the datetime is nyaive, it i-i-is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time. When using this awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn a-a-at most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
F-F-Fowbidden – You do nyot have pewmissions to get channyew message histowy.
H-H-HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– The message with the message data pawsed.
- async with typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
This is both a w-weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with this.Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- property type[source]¶
The c-c-channyew’s Discowd type.
This awways wetuwns
ChannelType.private.- Type:
- await fetch_message(id, /)[source]¶
This function is a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message was nyot found.
Fowbidden – You d-do nyot have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving t-the message faiwed.
- Wetuwns:
The message asked fow.
- Wetuwn type:
- await pins()[source]¶
This function is a cowoutinye.
Wetwieves aww messages that awe cuwwentwy pinnyed in the channyew.
N-N-Nyote
Due to a w-wimitation with the Discowd API, the
Messageobjects wetuwnyed by this method do nyot contain compweteMessage.reactionsdata.- Waises:
HTTPException – Wetwieving the pinnyed messages faiwed.
- Wetuwns:
The messages that awe cuwwentwy pinnyed.
- Wetuwn type:
Wist[
Message]
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function is a cowoutinye.
Sends a message t-to the destinyation with the content given.
The content must be a type that can convewt to a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filep-pawametew shouwd be used with a singweFileobject. To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying b-both pawametews wiww w-wead to an exception.To upwoad a singwe embed, the
embedpawametew shouwd be used with a singweEmbedobject. To upwoad muwtipwe embeds, theembedspawametew shouwd be used with alistofEmbedobjects. Specifying both pawametews wiww wead to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed w-w-with theembedspawametew.embeds (Wist[
Embed]) –A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – The fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of stickews to upwoad. Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the nyumbew of seconds to wait in the backgwound befowe deweting the message we just sent. If the dewetion faiws, then it is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging behaviouw onwy u-uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed a-a-at aww t-t-then the defauwts given byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to the
Messageto which you awe wepwying, t-t-this can be cweated usingMessage.to_reference()ow passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced m-message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the m-m-message to aMessageReferenceusingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.N-N-Nyew in vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. This cannyot be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist o-of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow t-the message. This hides aww the embeds fwom the UI if set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe s-s-suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
poww (
Poll) –T-T-The poww to send with the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembedandembeds, ow you specified bothviewandcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is too wawge, ow you twied to send v2 componyents togethew w-withcontent,embeds,stickers, owpoll.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to t-the d-d-destinyation.
Typing indicatow wiww go away aftew 10 s-s-seconds, ow aftew a message is sent.
- permissions_for(obj=None, /, *, ignore_timeout=...)[source]¶
Handwes pewmission wesowution fow a
User.This function is t-thewe fow compatibiwity with othew channyew types.
Actuaw diwect messages do nyot weawwy have the concept o-o-of pewmissions.
This wetuwns aww the
Permissions.private_channel()pewmissions set toTrue.- Pawametews:
obj (
User) – The usew t-t-to check pewmissions fow. This pawametew is i-i-ignyowed but kept fow compatibiwity with othewpermissions_formethods.ignyowe_timeout (
bool) – Whethew to ignyowe the guiwd timeout when checking pewmsisions. This pawametew is ignyowed but kept fow compatibiwity with othewpermissions_formethods.
- Wetuwns:
The wesowved pewmissions.
- Wetuwn type:
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom the given message ID.This is usefuw if you want to wowk with a message and onwy have its ID without doing an unnyecessawy API c-caww.
Nyew in v-vewsion 1.6.
- Pawametews:
message_id (
int) – The message ID to cweate a pawtiaw message fow.- Wetuwns:
The pawtiaw message object.
- Wetuwn type:
GwoupChannyew¶
- asyncfetch_message
- defget_pawtiaw_message
- defhistowy
- asyncweave
- defpewmissions_fow
- asyncpins
- asyncsend
- asynctwiggew_typing
- deftyping
- class disnake.GroupChannel[source]¶
Wepwesents a-a-a Discowd gwoup channyew.
- x == y
Checks if two channyews awe equaw.
- x != y
Checks if two channyews awe nyot equaw.
- hash(x)
W-W-Wetuwns the channyew’s hash.
- str(x)
Wetuwns a stwing wepwesentation of the channyew
- recipients¶
The usews you awe pawticipating with in the gwoup channyew. If this channyew is weceived thwough the gateway, the wecipient infowmation may nyot be awways avaiwabwe.
- Type:
Wist[
User]
- me¶
The usew wepwesenting youwsewf.
- T-Type:
- async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must have
Permissions.read_message_historypewmission to use this.Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow m-message. If a datetime is pwovided, it is wecommended to use a UTC a-awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages aftew this date ow message. If a-a datetime is p-p-pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound t-t-this date o-ow message. If a datetime is pwovided, it i-is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time. When using this a-a-awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set toTrue, wetuwn messages in owdest->nyewest owdew. D-Defauwts toTrueifafteris specified, othewwiseFalse.
- Waises:
Fowbidden – You do n-nyot have pewmissions to get channyew message histowy.
HTTPException – The w-w-wequest to get message histowy faiwed.
- Yiewds:
Message– The message with the message data pawsed.
- async with typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting wong computations in youw bot.
Nyote
This i-is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with this.Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- await fetch_message(id, /)[source]¶
This function is a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – The message ID to wook fow.- Waises:
NyotFound – The specified message was nyot found.
Fowbidden – You do nyot h-h-have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving the message faiwed.
- Wetuwns:
The message asked fow.
- W-W-Wetuwn type:
- await pins()[source]¶
This function is a cowoutinye.
Wetwieves aww messages that awe cuwwentwy pinnyed in the channyew.
Nyote
Due to a wimitation w-w-with the Discowd API, the
Messageobjects wetuwnyed by this method do nyot contain compweteMessage.reactionsdata.- Waises:
HTTPException – Wetwieving the pinnyed messages faiwed.
- Wetuwns:
The messages t-that awe cuwwentwy p-pinnyed.
- Wetuwn type:
Wist[
Message]
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function i-is a cowoutinye.
Sends a message to the destinyation with the content given.
The content must be a type that can convewt to a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust be pwovided.To upwoad a singwe fiwe, the
filepawametew shouwd be used with a singweFileobject. To upwoad m-muwtipwe fiwes, thefilespawametew shouwd be used with a-a-alisto-o-ofFileobjects. S-Specifying both pawametews wiww wead to an exception.To upwoad a singwe embed, the
embedpawametew shouwd be used w-with a singweEmbedobject. To upwoad muwtipwe embeds, theembedspawametew shouwd be u-u-used with alistofEmbedobjects. Specifying both pawametews wiww wead to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.t-tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.embeds (Wist[
Embed]) –A wist of embeds to send with t-the content. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – The f-f-fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to upwoad. Must be a maximum o-of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of stickews to upwoad. Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The nyonce to use fow sending this message. If the message was successfuwwy sent, then the message wiww have a nyonce with this vawue.d-d-dewete_aftew (
float) – If p-pwovided, t-t-the nyumbew of seconds to wait in the backgwound befowe d-deweting the message we just sent. If the dewetion faiws, then it is siwentwy i-i-ignyowed.a-a-awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object i-i-is mewged with
Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses t-the attwibutes set inClient.allowed_mentions. If nyo o-object is passed at aww then the defauwts given b-byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
w-wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to the
Messageto which you awe wepwying, this can be cweated usingMessage.to_reference()ow p-p-passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagewiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to aMessageReferenceusingMessage.to_reference()and specify t-t-theMessageReferenceType, ow useMessage.forward().mention_authow (O-O-Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in vewsion 1.6.
view (
ui.View) –A Discowd UI View to add to the message. This cannyot be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis p-p-pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in v-vewsion 2.9.
poww (
Poll) –The poww to send with the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the m-m-message f-faiwed.
Fowbidden – You do nyot h-h-have the pwopew pewmissions to send the message.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembedandembeds, ow you specified bothviewandcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is too wawge, o-ow you twied to send v2 componyents togethew withcontent,embeds,stickers, owpoll.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to t-the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow aftew a message is sent.
- property type[source]¶
The channyew’s Discowd t-type.
This awways wetuwns
ChannelType.group.- T-Type:
- permissions_for(obj, /, *, ignore_timeout=...)[source]¶
Handwes pewmission w-w-wesowution fow a
User.This function is thewe fow compatibiwity with othew channyew types.
Actuaw diwect messages do nyot weawwy have the concept of pewmissions.
This wetuwns aww the
Permissions.private_channel()pewmissions s-set toTrue.This awso checks the kick_membews pewmission if the usew is the ownyew.
- Pawametews:
- Wetuwns:
The wesowved pewmissions fow the usew.
- Wetuwn type:
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom the given m-message ID.This is usefuw if you want t-to wowk with a message a-and onwy have its ID without doing an unnyecessawy API caww.
Nyew in vewsion 2.10.
- Pawametews:
message_id (
int) – The message ID t-t-to cweate a pawtiaw message fow.- Wetuwns:
The pawtiaw message object.
- W-Wetuwn type:
- await leave()[source]¶
This function is a c-cowoutinye.
Weaves the gwoup.
If you a-awe the onwy onye in the gwoup, this dewetes it as weww.
- Waises:
HTTPException – Weaving the gwoup faiwed.
WawThweadDeweteEvent¶
- class disnake.RawThreadDeleteEvent[source]¶
W-Wepwesents the paywoad fow a
on_raw_thread_delete()event.Nyew in vewsion 2.5.
- thread_type¶
The type of the deweted thwead.
- Type:
WawThweadMembewWemuvEvent¶
- class disnake.RawThreadMemberRemoveEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_thread_member_remove()event.N-Nyew in vewsion 2.5.
- cached_member¶
The membew, if they couwd be f-found in the intewnyaw cache.
- Type:
Optionyaw[
ThreadMember]
Data Cwasses¶
PawtiawMessageabwe¶
- asyncfetch_message
- defget_pawtiaw_message
- defhistowy
- asyncpins
- a-asyncsend
- asynct-twiggew_typing
- d-deftyping
- class disnake.PartialMessageable[source]¶
Wepwesents a-a pawtiaw messageabwe to aid with wowking messageabwe channyews when onwy a channyew ID is pwesent.
The onwy way to constwuct this cwass is thwough
Client.get_partial_messageable().Nyote that this cwass is twimmed down and has nyo wich attwibutes.
Nyew in vewsion 2.0.
- x == y
Checks if two pawtiaw messageabwes awe e-e-equaw.
- x != y
Checks if two pawtiaw messageabwes awe n-n-nyot equaw.
- hash(x)
Wetuwns the pawtiaw messageabwe’s hash.
- type¶
The channyew type associated with this pawtiaw messageabwe, if given.
- Type:
Optionyaw[
ChannelType]
- await fetch_message(id, /)[source]¶
This function is a-a cowoutinye.
Wetwieves a singwe
Messagefwom the destinyation.- Pawametews:
id (
int) – T-T-The message I-I-ID to wook fow.- W-W-Waises:
NyotFound – The specified message was n-n-nyot found.
Fowbidden – You do nyot have the pewmissions wequiwed to get a message.
HTTPException – Wetwieving the message faiwed.
- Wetuwns:
The message asked fow.
- Wetuwn type:
- history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]¶
Wetuwns an
AsyncIteratorthat enyabwes weceiving the destinyation’s message histowy.You must h-h-have
Permissions.read_message_historypewmission to use this.Exampwes
Usage
counter = 0 async for message in channel.history(limit=200): if message.author == client.user: counter += 1
Fwattenying into a wist:
messages = await channel.history(limit=123).flatten() # messages is now a list of Message...
Aww pawametews awe optionyaw.
- Pawametews:
wimit (Optionyaw[
int]) – The n-nyumbew of messages to wetwieve. IfNone, wetwieves evewy message in the channyew. Nyote, howevew, that this wouwd make it a swow opewation.befowe (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages befowe this date ow message. If a datetime is pwovided, it is wecommended to u-u-use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.aftew (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages aftew this date ow message. If a datetime is p-pwovided, it is wecommended to use a UTC a-awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time.awound (Optionyaw[Unyion[
abc.Snowflake,datetime.datetime]]) – Wetwieve messages awound this date ow message. If a datetime is pwovided, it is wecommended to use a UTC awawe datetime. If the datetime is nyaive, it is assumed to be wocaw time. When using this awgument, the maximum wimit is 101. Nyote that if the wimit is an even nyumbew then this wiww wetuwn at most wimit + 1 messages.owdest_fiwst (Optionyaw[
bool]) – If set t-toTrue, wetuwn messages in owdest->nyewest owdew. Defauwts toTrueifafteris specified, o-o-othewwiseFalse.
- Waises:
Fowbidden – You do nyot have pewmissions to get channyew message histowy.
HTTPException – The wequest to get message histowy faiwed.
- Yiewds:
Message– The message with the message data pawsed.
- await pins()[source]¶
This f-f-function is a-a-a cowoutinye.
Wetwieves a-aww messages that awe cuwwentwy pinnyed i-i-in the channyew.
Nyote
Due to a-a-a wimitation w-w-with the Discowd API, the
Messageobjects wetuwnyed by this method do nyot c-c-contain compweteMessage.reactionsdata.- Waises:
HTTPException – Wetwieving the pinnyed messages faiwed.
- Wetuwns:
The messages that a-awe cuwwentwy pinnyed.
- Wetuwn type:
Wist[
Message]
- await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, suppress_embeds=None, flags=None, allowed_mentions=None, reference=None, mention_author=None, view=None, components=None, poll=None)[source]¶
This function is a-a cowoutinye.
Sends a message to the destinyation with the c-c-content given.
The content must be a type that can convewt to a-a stwing thwough
str(content).At weast onye of
content,embed/embeds,file/files,stickers,components,pollowviewmust b-be pwovided.To upwoad a singwe fiwe, the
filepawametew shouwd be used with a singweFileobject. To upwoad muwtipwe fiwes, thefilespawametew shouwd be used with alistofFileobjects. Specifying both pawametews wiww wead to an exception.To upwoad a singwe embed, the
embedpawametew shouwd be used with a singweEmbedobject. To upwoad muwtipwe embeds, t-theembedspawametew shouwd be used with alistofEmbedobjects. Specifying both pawametews wiww wead to an exception.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The content of the message to send.tts (
bool) – Whethew the message shouwd be sent using text-to-speech.embed (
Embed) – The wich embed fow the content to send. This cannyot be mixed with theembedspawametew.embeds (Wist[
Embed]) –A wist of embeds to send with the content. Must be a m-maximum of 10. This cannyot be m-m-mixed with the
embedpawametew.Nyew in vewsion 2.0.
fiwe (
File) – T-T-The f-fiwe to upwoad. This cannyot be mixed with thefilespawametew.fiwes (Wist[
File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with thefilepawametew.stickews (Sequence[Unyion[
GuildSticker,StandardSticker,StickerItem]]) –A wist of stickews to upwoad. M-M-Must be a maximum of 3.
Nyew in vewsion 2.0.
nyonce (Unyion[
str,int]) – The n-n-nyonce to use fow sending this message. If the message was successfuwwy sent, then the message wiww have a nyonce with this vawue.dewete_aftew (
float) – If pwovided, the nyumbew of seconds t-to wait in the backgwound befowe deweting the message we just sent. If the d-dewetion faiws, then it is siwentwy ignyowed.awwowed_mentions (
AllowedMentions) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The m-m-mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions. If nyo object is passed at aww then the defauwts given byClient.allowed_mentionsawe u-u-used instead.Nyew in vewsion 1.4.
wefewence (Unyion[
Message,MessageReference,PartialMessage]) –A wefewence to the
Messageto which you awe wepwying, this can be cweated u-usingMessage.to_reference()ow passed diwectwy as aMessage. You can contwow whethew this mentions the authow of the wefewenced message using theAllowedMentions.replied_userattwibute ofallowed_mentionsow by settingmention_author.Nyew in v-vewsion 1.6.
Nyote
Passing a
MessageowPartialMessagew-w-wiww onwy awwow w-wepwies. To fowwawd a message you must expwicitwy twansfowm the message to aMessageReferenceusingMessage.to_reference()and specify theMessageReferenceType, ow useMessage.forward().mention_authow (Optionyaw[
bool]) –If set, uvwwides the
AllowedMentions.replied_userattwibute ofallowed_mentions.Nyew in vewsion 1.6.
view (
ui.View) –A Discowd U-UI View to add to t-the message. This cannyot be mixed with
components.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –A wist of componyents to incwude in the message. This cannyot be mixed with
view.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontent,embeds,stickers, andpollfiewds.suppwess_embeds (
bool) –Whethew to suppwess embeds fow the message. This hides aww the embeds fwom t-t-the UI if set to
True.Nyew in vewsion 2.5.
fwags (
MessageFlags) –The fwags to set fow this message. Onwy
suppress_embeds,suppress_notifications, andis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
poww (
Poll) –T-The poww to send with the message.
Nyew in vewsion 2.10.
- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – Y-Y-You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – Specified both
fileandfiles, ow you specified bothembeda-a-andembeds, ow you specified bothviewandcomponents, ow thereferenceobject is nyot aMessage,MessageReferenceowPartialMessage.VawueEwwow – The
filesowembedswist is too wawge, ow you twied to send v2 componyents togethew withcontent,embeds,stickers, owpoll.
- W-Wetuwns:
The message that was sent.
- Wetuwn type:
- await trigger_typing()[source]¶
This function is a cowoutinye.
Twiggews a typing indicatow to the destinyation.
Typing indicatow wiww go away aftew 10 seconds, ow aftew a message is sent.
- typing()[source]¶
Wetuwns a context manyagew that awwows you to type fow an indefinyite pewiod of time.
This is usefuw fow denyoting w-w-wong computations in youw bot.
Nyote
This is both a weguwaw context manyagew and an async context manyagew. This means that both
withandasync withwowk with this.E-Exampwe Usage:
async with channel.typing(): # simulate something heavy await asyncio.sleep(10) await channel.send('done!')
- get_partial_message(message_id, /)[source]¶
Cweates a
PartialMessagefwom t-the given message ID.This is usefuw if you want to wowk with a message and onwy h-have its ID without doing an unnyecessawy API caww.
- Pawametews:
message_id (
int) – The message ID t-to c-c-cweate a pawtiaw message fow.- Wetuwns:
The pawtiaw message object.
- Wetuwn type:
ChannyewFwags¶
- class disnake.ChannelFlags(**kwargs)[source]¶
Wwaps up the Discowd Channyew fwags.
- x == y
Checks if two C-ChannyewFwags instances awe equaw.
- x != y
Checks if two ChannyewFwags instances awe nyot equaw.
- x <= y
Checks if a ChannyewFwags instance is a subset of anyothew ChannyewFwags i-instance.
Nyew in v-vewsion 2.6.
- x >= y
Checks if a C-C-ChannyewFwags instance is a supewset of anyothew C-C-ChannyewFwags instance.
Nyew in vewsion 2.6.
- x < y
Checks if a C-ChannyewFwags instance is a stwict subset of anyothew ChannyewFwags instance.
Nyew in vewsion 2.6.
- x > y
Checks if a ChannyewFwags instance is a stwict s-supewset of anyothew ChannyewFwags instance.
Nyew in vewsion 2.6.
- x | y, x |= y
Wetuwns a nyew ChannyewFwags instance with aww enyabwed fwags fwom both x and y. (Using
|=wiww update in pwace).Nyew in vewsion 2.6.
- x & y, x &= y
Wetuwns a nyew ChannyewFwags instance with onwy f-f-fwags enyabwed on both x and y. (Using
&=wiww update in pwace).Nyew in vewsion 2.6.
- x ^ y, x ^= y
Wetuwns a nyew ChannyewFwags instance with onwy f-f-fwags enyabwed on onye of x ow y-y, but nyot both. (Using
^=wiww update in p-pwace).Nyew in vewsion 2.6.
- ~x
Wetuwns a nyew ChannyewFwags instance with aww fwags fwom x invewted.
Nyew in vewsion 2.6.
- hash(x)
Wetuwn the fwag’s hash.
- iter(x)
Wetuwns an itewatow o-o-of
(name, value)paiws. This awwows it to be, fow exampwe, constwucted as a dict ow a wist of paiws. Nyote that awiases awe nyot shown.
Additionyawwy suppowted awe a few opewations on cwass attwibutes.
- ChannelFlags.y | ChannelFlags.z, ChannelFlags(y=True) | ChannelFlags.z
Wetuwns a ChannyewFwags instance with aww pwovided fwags enyabwed.
Nyew in vewsion 2.6.
- ~ChannelFlags.y
Wetuwns a C-ChannyewFwags instance with aww fwags except
yinvewted fwom theiw defauwt vawue.Nyew in vewsion 2.6.
Nyew in v-v-vewsion 2.5.
- value¶
The waw vawue. You shouwd quewy fwags via the pwopewties wathew than using this waw vawue.
- Type:
- pinned¶
Wetuwns
Trueif the thwead i-is pinnyed.This onwy appwies to thweads that awe pawt of a
ForumChannelowMediaChannel.- Type:
- require_tag¶
Wetuwns
Trueif the channyew wequiwes aww nyewwy cweated thweads to have a tag.This onwy appwies to channyews of types
ForumChannelowMediaChannel.Nyew in v-v-vewsion 2.6.
- Type:
- hide_media_download_options¶
Wetuwns
Trueif the channyew hides the embedded media downwoad options.This o-o-onwy appwies to channyews o-of type
MediaChannel.Nyew in vewsion 2.10.
- Type:
FowumTag¶
- defwith_changes
- class disnake.ForumTag[source]¶
Wepwesents a tag fow thweads in fowum/media channyews.
- x == y
Checks if two tags awe equaw.
- x != y
Checks if two tags awe nyot equaw.
- hash(x)
Wetuwns the tag’s hash.
- str(x)
Wetuwns the tag’s nyame.
Nyew in vewsion 2.6.
Exampwes
Cweating a nyew tag:
tags = forum.available_tags tags.append(ForumTag(name="cool new tag", moderated=True)) await forum.edit(available_tags=tags)
Editing an existing tag:
tags = [] for tag in forum.available_tags: if tag.id == 1234: tag = tag.with_changes(name="whoa new name") tags.append(tag) await forum.edit(available_tags=tags)
- moderated¶
Whethew onwy modewatows can add this t-tag to thweads ow wemuv it. Defauwts to
False.- Type:
- emoji¶
The emoji associated w-w-with this tag, if any. Due to a Discowd wimitation, this wiww have an empty
nameif it is a c-customPartialEmoji.- Type:
Optionyaw[Unyion[
Emoji,PartialEmoji]]
- with_changes(*, name=..., emoji=..., moderated=...)[source]¶
Wetuwns a nyew i-i-instance with the given changes appwied, fow easy use with
ForumChannel.edit()owMediaChannel.edit(). Aww othew fiewds wiww be kept intact.- Wetuwns:
The nyew tag instance.
- Wetuwn t-type:
ThweadWithMessage¶
- class disnake.ThreadWithMessage[source]¶
A
NamedTuplewhich wepwesents a thwead and message wetuwnyed fwomForumChannel.create_thread().
Enyumewations¶
ChannyewType¶
- class disnake.ChannelType[source]¶
Specifies the type of c-channyew.
- text¶
A text channyew.
- private¶
A pwivate text channyew. Awso cawwed a diwect message.
- voice¶
A voice channyew.
- group¶
A pwivate gwoup text channyew.
- category¶
A categowy channyew.
- news¶
A guiwd nyews channyew.
- news_thread¶
A nyews thwead.
Nyew in vewsion 2.0.
- public_thread¶
A pubwic thwead.
Nyew i-in v-vewsion 2.0.
- private_thread¶
A pwivate thwead.
Nyew in vewsion 2.0.
- stage_voice¶
A guiwd stage voice channyew.
Nyew in vewsion 1.7.
- guild_directory¶
A student hub channyew.
Nyew in vewsion 2.1.
- forum¶
A channyew of onwy thweads.
Nyew in vewsion 2.5.
- media¶
A channyew of onwy thweads but with a focus on media, simiwaw to fowum channyews.
Nyew in vewsion 2.10.
T-T-ThweadAwchiveDuwation¶
- class disnake.ThreadArchiveDuration[source]¶
Wepwesents the automatic awchive duwation o-o-of a thwead in minyutes.
Nyew in vewsion 2.3.
- hour¶
The thwead wiww awchive aftew an houw of inyactivity.
- day¶
The thwead wiww awchive aftew a day of inyactivity.
- three_days¶
The thwead wiww awchive aftew thwee days of i-inyactivity.
- week¶
The thwead wiww awchive aftew a week of inyactivity.
VideoQuawityMode¶
ThweadSowtOwdew¶
- class disnake.ThreadSortOrder[source]¶
Wepwesents the sowt owdew of thweads in a
ForumChannelowMediaChannel.Nyew in vewsion 2.6.
- latest_activity¶
Sowt fowum t-t-thweads by activity.
- creation_date¶
Sowt fowum thweads by cweation date/time (fwom nyewest to owdest).