Channyews

This section documents evewything wewated to channyews and thweads.

Discowd Modews

T-TextChannyew

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.

name

The channyew’s nyame.

Type:

str

guild

The guiwd the channyew bewongs to.

Type:

Guild

id

The channyew’s ID.

Type:

int

category_id

The categowy channyew ID this channyew bewongs to, if appwicabwe.

Type:

Optionyaw[int]

topic

The channyew’s topic. None if it doesn’t exist.

Type:

Optionyaw[str]

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:

int

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_channels ow manage_messages pewmissions, bypass swowmode.

See awso default_thread_slowmode_delay.

Type:

int

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 0 denyotes that it i-is disabwed. Bots, and usews with manage_channels ow manage_messages, bypass swowmode.

Nyew in vewsion 2.8.

Type:

int

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:

bool

default_auto_archive_duration

The defauwt auto awchive duwation in minyutes fow thweads cweated in this channyew.

Nyew in vewsion 2.0.

Type:

int

last_pin_timestamp

The time the most wecent message was pinnyed, ow None if 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 AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, othewwise False.

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 with and async with wowk 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.text ow ChannelType.news.

Type:

ChannelType

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes p-pewmission wesowution fow the Member ow Role.

This function takes into considewation the f-fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • Channyew uvwwides

  • Membew uvwwides

  • Timeouts

If a Role is 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 Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions instead.

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 Member objects.

    Changed in vewsion 2.6: The defauwt was changed t-t-to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

property members[source]

Wetuwns aww membews that can see this channyew.

Type:

Wist[Member]

property threads[source]

Wetuwns aww the thweads that y-you can see.

Nyew in vewsion 2.0.

Type:

Wist[Thread]

is_nsfw()[source]

Whethew the channyew is mawked as NSFW.

Wetuwn t-t-type:

bool

is_news()[source]

W-W-Whethew the channyew is a nyews channyew.

Wetuwn type:

bool

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() ow fetch_message() with the last_message_id attwibute.

Wetuwns:

The wast message in this channyew ow None if 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_channels pewmission to do this.

Changed in vewsion 1.3: The overwrites keywowd-onwy pawametew was added.

Changed in vewsion 1.4: The type keywowd-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 TypeError ow ValueError i-i-instead of InvalidArgument.

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 to False.

  • c-c-categowy (Optionyaw[abc.Snowflake]) – The nyew categowy fow this channyew. Can be None to wemuv the categowy.

  • swowmode_deway (Optionyaw[int]) – Specifies the s-swowmode wate wimit fow usews in this channyew, in seconds. A vawue of 0 disabwes swowmode. The m-maximum vawue possibwe is 21600.

  • 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 0 ow None disabwes swowmode. The maximum vawue p-p-possibwe is 21600.

    Nyew i-i-in vewsion 2.8.

  • type (ChannelType) – The nyew type of this text channyew. C-C-Cuwwentwy, onwy convewsion between ChannelType.text and ChannelType.news is s-s-suppowted. This is onwy avaiwabwe to guiwds that contain NEWS in Guild.features.

  • uvwwwites (Mapping) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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 of 60, 1440, 4320, ow 10080.

  • 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 None is 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_channels pewmission 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, news and overwrites keywowd-onwy pawametews.

Nyote

The cuwwent TextChannel.flags vawue 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 of 0 ow None disabwes swowmode. The maximum vawue possibwe is 21600. 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) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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 contain NEWS in Guild.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:

TextChannel

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_messages pewmission 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 a check is nyot pwovided then aww messages awe deweted without discwiminyation.

You m-m-must have manage_messages pewmission to dewete messages even if they awe youw own. read_message_history pewmission 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:
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_webhooks pewmission to use this.

Waises:

Fowbidden – You don’t have p-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 i-i-is a cowoutinye.

Cweates a webhook fow this channyew.

You must have manage_webhooks pewmission to do this.

Changed in vewsion 1.1: The reason keywowd-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:
Wetuwns:

The nyewwy cweated webhook.

Wetuwn type:

Webhook

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 TypeError instead of InvalidArgument.

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:

Webhook

get_partial_message(message_id, /)[source]

Cweates a PartialMessage fwom 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:

PartialMessage

get_thread(thread_id, /)[source]

Wetuwns a thwead with the given ID.

Nyew in vewsion 2.0.

Pawametews:

thwead_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed thwead ow None if nyot found.

Wetuwn type:

Optionyaw[Thread]

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_threads pewmission. Fow a pwivate thwead, create_private_threads pewmission is n-n-nyeeded instead.

Nyew in vewsion 2.0.

Changed in vewsion 2.5:

  • Onwy onye of message and type may be pwovided.

  • type is nyow wequiwed if message is 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 of 60, 1440, 4320, ow 10080.

  • invitabwe (bool) –

    Whethew n-n-nyon-modewatows can add othew nyon-modewatows to this thwead. Onwy avaiwabwe fow pwivate thweads. If a message is passed then this pawametew is ignyowed, as a thwead cweated with a message is awways a pubwic thwead. Defauwts to True.

    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 0 disabwes swowmode. The maximum vawue possibwe is 21600. If set to None ow nyot pwovided, swowmode is inhewited fwom the pawent’s default_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:

Thread

archived_threads(*, private=False, joined=False, limit=50, before=None)[source]

Wetuwns an AsyncIterator that itewates uvw aww a-a-awchived thweads in the channyew.

You must have read_message_history pewmission to use this. If itewating uvw pwivate thweads then manage_threads pewmission is awso wequiwed.

Nyew in vewsion 2.0.

Pawametews:
  • wimit (Optionyaw[int]) – The nyumbew of thweads to wetwieve. If None, 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 set joined to True and private to False.

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.roles attwibute.

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_invite pewmission to do this.

Pawametews:
  • max_age (int) – How wong the invite shouwd wast in seconds. If set to 0, then the invite doesn’t expiwe. Defauwts to 0.

  • max_uses (int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts t-to 0.

  • tempowawy (bool) – Whethew the invite gwants tempowawy m-m-membewship (i.e. they get kicked aftew they disconnyect). Defauwts to False.

  • unyique (bool) – Whethew a unyique invite UWW shouwd be cweated. Defauwts t-to True. If this is set t-t-to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew i-i-in vewsion 2.0.

    Changed i-in v-vewsion 2.9: PartyType is depwecated, and Snowflake shouwd 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:

Invite

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This function is a cowoutinye.

Dewetes the channyew.

You must have Permissions.manage_channels pewmission 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 Message fwom 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:

Message

property flags[source]

The channyew fwags fow this channyew.

Nyew in vewsion 2.6.

Type:

ChannelFlags

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_channels pewmission 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.

property mention[source]

The stwing that awwows you to mention the channyew.

T-Type:

str

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, edit shouwd be used instead.

You must have Permissions.manage_channels pewmission 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 TypeError o-o-ow ValueError instead of InvalidArgument.

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 with end, before, and after.

  • e-e-end (bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This is mutuawwy excwusive with beginning, before, and after.

  • befowe (abc.Snowflake) – The channyew that shouwd be befowe ouw cuwwent channyew. This is m-mutuawwy excwusive with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew that shouwd be aftew o-ouw cuwwent channyew. This is mutuawwy excwusive w-w-with beginning, end, and before.

  • offset (int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset of 2 with beginning=True wouwd 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 the beginning, end, before, and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to m-m-muv this channyew u-u-undew. If None i-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 Role ow a Member and the vawue is the uvwwwite as a PermissionOverwrite.

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.

Pawametews:

obj (Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

Wetuwns:

The pewmission uvwwwites fow this object.

Wetuwn type:

PermissionOverwrite

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:

bool

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 Message objects wetuwnyed by this m-m-method do nyot contain compwete Message.reactions data.

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file pawametew shouwd b-be used with a singwe File object. T-To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying both pawametews wiww wead to an exception.

To upwoad a singwe embed, the embed pawametew shouwd be used with a-a-a singwe Embed object. To upwoad muwtipwe embeds, the embeds pawametew shouwd b-b-be used with a list of Embed objects. Specifying both pawametews w-w-wiww wead to a-a-an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – The fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (W-Wist[File]) – A w-w-wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be m-mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object i-i-is passed at aww then the d-defauwts given by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • wefewence (U-Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to the Message to which you awe wepwying, t-this can be cweated using Message.to_reference() ow passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To f-fowwawd a message you must expwicitwy twansfowm the message to a MessageReference u-using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides t-the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file a-and files, ow you specified b-both embed and embeds, o-ow you specified both view and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds w-wist i-i-is too wawge, ow you t-twied to send v2 componyents togethew with content, embeds, stickers, ow poll.

Wetuwns:

The message that was sent.

Wetuwn type:

Message

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 target pawametew shouwd eithew be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyoting Permissions attwibutes. If this i-i-is donye, then you cannyot mix the keywowd awguments with the overwrite pawametew.

If the overwrite pawametew is None, then the pewmission uvwwwites awe deweted.

You must have Permissions.manage_roles pewmission to do this.

Nyote

This method wepwaces the owd uvwwwites with the onyes given.

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

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 PermissionOverwrite

overwrite = 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, ow None to 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.

  • TypeEwwowoverwrite is invawid, the tawget type was nyot Role ow Member, b-b-both keywowd awguments and overwrite wewe 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

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.

name

The channyew’s nyame.

Type:

str

guild

The guiwd the channyew bewongs to.

Type:

Guild

id

The channyew’s ID.

Type:

int

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:

int

bitrate

T-T-The c-channyew’s pwefewwed audio bitwate i-i-in bits pew second.

Type:

int

user_limit

The channyew’s wimit fow nyumbew of membews that can be in a voice channyew.

Type:

int

rtc_region

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

Nyew in v-vewsion 1.7.

Changed in vewsion 2.5: Nyo wongew a VoiceRegion instance.

Type:

Optionyaw[str]

video_quality_mode

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

T-T-Type:

VideoQualityMode

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:

bool

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_channels ow manage_messages, bypass swowmode.

Nyew in vewsion 2.3.

Type:

int

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:

ChannelType

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_channels pewmission to do this.

Changed i-i-in vewsion 2.9: Added bitrate, user_limit, position, category, rtc_region, video_quality_mode, nsfw, slowmode_delay and overwrites keywowd-onwy pawametews.

Nyote

The cuwwent VoiceChannel.flags vawue 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) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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:

VoiceChannel

is_nsfw()[source]

Whethew the channyew is mawked as N-N-NSFW.

Nyew in vewsion 2.3.

Wetuwn type:

bool

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() ow fetch_message() with the last_message_id attwibute.

Nyew in v-v-vewsion 2.3.

Wetuwns:

The wast message in this channyew ow None if nyot found.

Wetuwn type:

Optionyaw[Message]

get_partial_message(message_id, /)[source]

C-C-Cweates a PartialMessage fwom 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:

PartialMessage

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_channels pewmission to do this.

Changed in vewsion 1.3: The overwrites keywowd-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 TypeError ow ValueError instead of InvalidArgument.

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 to False.

  • c-c-categowy (Optionyaw[abc.Snowflake]) – The nyew categowy fow this channyew. Can be None to wemuv the categowy.

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

  • uvwwwites (Mapping) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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 None indicates 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 0 disabwes swowmode. The maximum vawue possibwe is 21600.

    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 None is 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_messages pewmission 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-a check is nyot pwovided then aww messages awe deweted without discwiminyation.

Y-You must have manage_messages pewmission to dewete messages even if they awe y-y-youw own. read_message_history pewmission is awso nyeeded to wetwieve message histowy.

Nyew in vewsion 2.5.

Nyote

See TextChannel.purge() fow exampwes.

Pawametews:
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_webhooks pewmission to use this.

Nyew in vewsion 2.5.

Waises:

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 f-f-function is a cowoutinye.

Cweates a webhook fow this channyew.

You must have manage_webhooks pewmission to do this.

Nyew in vewsion 2.5.

Pawametews:
  • n-nyame (str) – The webhook’s nyame.

  • avataw (Optionyaw[bytes]) – The webhook’s defauwt avataw. This opewates simiwawwy to edit().

  • weason (Optionyaw[str]) – The weason fow cweating this webhook. Shows up in the audit wogs.

Waises:
Wetuwns:

The nyewwy cweated webhook.

Wetuwn type:

Webhook

await send_soundboard_sound(sound, /)[source]

This function is a cowoutinye.

Sends a soundboawd sound in this channyew.

You must have speak and use_soundboard pewmissions to do this. Fow s-sounds fwom diffewent guiwds, you must awso have use_external_sounds pewmission. 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.roles attwibute.

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 VoiceClient to 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 subcwasses VoiceProtocol to connyect with. Defauwts to VoiceClient.

Waises:
Wetuwns:

A voice cwient that is fuwwy connyected to the voice sewvew.

Wetuwn type:

VoiceProtocol

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_invite pewmission to do this.

Pawametews:
  • max_age (int) – How wong the invite s-shouwd wast in seconds. If set to 0, then the invite doesn’t expiwe. Defauwts to 0.

  • max_uses (int) – How many uses the invite couwd be used fow. If it’s 0 t-then thewe awe u-unwimited uses. Defauwts to 0.

  • t-tempowawy (bool) – Whethew the invite gwants t-t-tempowawy membewship (i.e. they get kicked aftew they disconnyect). Defauwts to False.

  • unyique (bool) – Whethew a u-u-unyique invite UWW shouwd be cweated. Defauwts to True. If this is set t-to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew in vewsion 2.0.

    Changed in vewsion 2.9: PartyType is depwecated, and Snowflake shouwd 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:

Invite

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This function is a-a-a cowoutinye.

D-Dewetes the channyew.

You must have Permissions.manage_channels pewmission 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 Message fwom 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:

Message

property flags[source]

The channyew fwags fow t-t-this channyew.

Nyew in vewsion 2.6.

Type:

ChannelFlags

history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, othewwise False.

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_channels pewmission 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]

property mention[source]

The stwing that awwows you to mention the channyew.

Type:

str

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, edit shouwd be used instead.

You must h-h-have Permissions.manage_channels 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 TypeError ow ValueError instead of InvalidArgument.

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 with end, before, and after.

  • end (bool) – Whethew to muv the channyew to t-the end of the channyew wist (ow categowy if given). This is mutuawwy e-excwusive with beginning, before, and after.

  • befowe (abc.Snowflake) – The channyew that s-shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew t-that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and before.

  • offset (int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an o-offset of 2 with beginning=True wouwd 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 the beginning, end, before, and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to muv this channyew undew. If None is 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 Role ow a Member and the vawue is t-the uvwwwite as a PermissionOverwrite.

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.

Pawametews:

obj (Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

Wetuwns:

The pewmission uvwwwites fow this o-object.

Wetuwn type:

PermissionOverwrite

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes p-p-pewmission wesowution fow the Member ow Role.

This f-function takes into considewation the fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • Channyew uvwwides

  • Membew uvwwides

  • Timeouts

If a Role is 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 Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed a-a-appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions i-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 Member objects.

    Changed in vewsion 2.6: The defauwt was changed to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

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:

bool

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file pawametew shouwd be used with a-a singwe File object. To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying both pawametews wiww wead to an exception.

To upwoad a singwe embed, the embed pawametew shouwd be used w-with a singwe Embed object. To upwoad muwtipwe embeds, the embeds pawametew shouwd be used with a list of Embed objects. Specifying both pawametews wiww wead to an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew i-i-in vewsion 2.0.

  • fiwe (File) – The fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A w-wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object is passed at aww then the defauwts given by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to t-the Message to which you awe wepwying, this can be cweated using Message.to_reference() ow passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced m-m-message using the AllowedMentions.replied_user attwibute of allowed_mentions o-ow by setting mention_author.

    Nyew in v-v-vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To fowwawd a message you must expwicitwy t-t-twansfowm the message to a MessageReference using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed and embeds, ow you specified both view and components, ow the reference o-o-object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is t-t-too wawge, ow you twied to send v2 componyents togethew with content, embeds, stickers, ow poll.

Wetuwns:

The message that was sent.

Wetuwn type:

Message

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 target pawametew shouwd eithew be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyoting Permissions attwibutes. If this is donye, then you c-c-cannyot mix the keywowd awguments with the overwrite pawametew.

If the overwrite pawametew is None, then the pewmission uvwwwites awe d-d-deweted.

You must have Permissions.manage_roles pewmission to do this.

Nyote

This method wepwaces the owd uvwwwites with the onyes given.

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

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 PermissionOverwrite

overwrite = 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, ow None to 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.

  • TypeEwwowoverwrite is invawid, the tawget type was nyot Role ow Member, b-both keywowd awguments and overwrite wewe 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 with and async with w-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 members when 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

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.

name

The categowy nyame.

Type:

str

guild

The guiwd the categowy bewongs t-to.

Type:

Guild

id

The categowy channyew I-I-ID.

Type:

int

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:

int

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:

bool

property type[source]

The channyew’s Discowd type.

This awways w-wetuwns ChannelType.category.

Type:

ChannelType

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes pewmission wesowution fow the Member ow Role.

This function takes into considewation the f-f-fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • Channyew uvwwides

  • Membew uvwwides

  • Timeouts

If a Role is 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 Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions i-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 Member objects.

    Changed in vewsion 2.6: The defauwt was changed to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

is_nsfw()[source]

Whethew the categowy is m-m-mawked as NSFW.

Wetuwn type:

bool

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_channels pewmission t-t-to do this.

Changed in vewsion 2.9: Added position, nsfw and overwrites keywowd-onwy pawametews.

Nyote

The cuwwent CategoryChannel.flags vawue 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) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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:

CategoryChannel

await edit(*, name=..., position=..., nsfw=..., overwrites=..., flags=..., reason=None, **kwargs)[source]

This function is a cowoutinye.

Edits the categowy.

You must have manage_channels pewmission to do this.

Changed in vewsion 1.3: The overwrites keywowd-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 TypeError ow ValueError instead of InvalidArgument.

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) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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 None is 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, edit shouwd be used instead.

You must have Permissions.manage_channels p-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 TypeError ow ValueError instead of InvalidArgument.

Pawametews:
  • beginnying (bool) – Whethew to muv t-the channyew to the beginnying of the channyew wist (ow categowy if given). This is mutuawwy excwusive with end, before, and after.

  • end (bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This i-i-is mutuawwy excwusive with beginning, before, and after.

  • befowe (abc.Snowflake) – The channyew that shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and before.

  • offset (int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset of 2 with beginning=True wouwd 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 the beginning, end, before, and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to muv this channyew undew. If None is 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:
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 a TextChannel in the categowy.

Wetuwns:

The nyewwy cweated text channyew.

Wetuwn type:

TextChannel

await create_voice_channel(name, **options)[source]

This f-function is a cowoutinye.

A showtcut method to Guild.create_voice_channel() to cweate a VoiceChannel in the categowy.

Wetuwns:

The nyewwy cweated voice channyew.

Wetuwn type:

VoiceChannel

await create_stage_channel(name, **options)[source]

This function is a cowoutinye.

A showtcut m-m-method to Guild.create_stage_channel() to cweate a StageChannel in the categowy.

Nyew in vewsion 1.7.

Wetuwns:

T-T-The nyewwy cweated stage channyew.

Wetuwn type:

StageChannel

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 a ForumChannel in the categowy.

Nyew in vewsion 2.5.

Wetuwns:

The nyewwy cweated fowum channyew.

Wetuwn type:

ForumChannel

await create_media_channel(name, **options)[source]

This function is a cowoutinye.

A s-s-showtcut method to Guild.create_media_channel() to cweate a MediaChannel in the categowy.

Nyew in vewsion 2.10.

Wetuwns:

The nyewwy cweated media channyew.

Wetuwn type:

MediaChannel

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.roles attwibute.

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_invite pewmission to do this.

Pawametews:
  • max_age (int) – How wong the invite shouwd wast i-in seconds. I-If set to 0, then the invite doesn’t expiwe. Defauwts to 0.

  • 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 to 0.

  • tempowawy (bool) – Whethew the invite gwants tempowawy membewship (i.e. t-t-they get kicked aftew they disconnyect). Defauwts to False.

  • unyique (bool) – Whethew a unyique invite U-U-UWW shouwd be c-c-cweated. Defauwts t-to True. If this is set t-t-to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew in vewsion 2.0.

    Changed i-i-in vewsion 2.9: PartyType is depwecated, and Snowflake shouwd 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:

Invite

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This function is a cowoutinye.

Dewetes the channyew.

You must have Permissions.manage_channels pewmission 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.

property flags[source]

The channyew fwags fow this channyew.

Nyew in vewsion 2.6.

Type:

ChannelFlags

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_channels pewmission 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 mention[source]

The stwing that awwows you to mention the channyew.

Type:

str

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 Role ow a-a-a Member and the vawue is the uvwwwite as a-a-a PermissionOverwrite.

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.

Pawametews:

obj (Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

Wetuwns:

The pewmission uvwwwites fow this object.

W-Wetuwn type:

PermissionOverwrite

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:

bool

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 target pawametew shouwd eithew be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyoting Permissions attwibutes. If this is donye, then you cannyot mix the keywowd awguments with t-the overwrite pawametew.

If the overwrite pawametew is None, then t-the pewmission uvwwwites awe deweted.

You must have Permissions.manage_roles pewmission to do this.

Nyote

This method wepwaces the owd uvwwwites with the onyes given.

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

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 PermissionOverwrite

overwrite = 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, ow None to 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.

  • TypeEwwowoverwrite is invawid, the tawget type was n-nyot Role ow Member, both keywowd awguments and overwrite wewe pwovided, ow invawid pewmissions wewe pwovided as k-keywowd awguments.

Thwead

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.

name

The thwead nyame.

Type:

str

guild

The guiwd the thwead bewongs to.

Type:

Guild

id

The thwead ID.

Type:

int

parent_id

The pawent TextChannel, ForumChannel, ow MediaChannel ID this thwead bewongs to.

Type:

int

owner_id

The usew’s ID that cweated this thwead.

Type:

Optionyaw[int]

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_channels ow manage_messages, b-b-bypass swowmode.

Type:

int

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]

archived

Whethew the thwead is awchived.

Type:

bool

locked

Whethew the thwead is w-wocked.

Type:

bool

invitable

Whethew nyon-modewatows can add othew nyon-modewatows to this thwead. This is awways True fow pubwic thweads.

Type:

bool

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:

int

archive_timestamp

An awawe timestamp of when the thwead’s awchived status was wast updated in UTC.

Type:

datetime.datetime

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 None if 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 AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, othewwise False.

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 with and async with wowk 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, ow ChannelType.news_thread.

Type:

ChannelType

property parent[source]

The pawent channyew this thwead bewongs to.

Type:

Optionyaw[Unyion[TextChannel, ForumChannel, MediaChannel]]

property owner[source]

The membew this thwead bewongs to.

Type:

Optionyaw[Member]

property mention[source]

The stwing t-t-that awwows you to mention the thwead.

Type:

str

property members[source]

A wist of thwead membews i-i-in this thwead.

This wequiwes Intents.members to be pwopewwy fiwwed. Most of the time howevew, this data is n-n-nyot pwovided by the gateway and a caww to fetch_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() ow fetch_message() w-with the last_message_id attwibute.

Wetuwns:

The wast message in this channyew ow None if 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_timestamp is pwovided by Discowd, that wiww be used instead of the time in the ID.

Type:

datetime.datetime

property flags[source]

The channyew fwags fow this thwead.

Nyew in vewsion 2.5.

Type:

ChannelFlags

property jump_url[source]

A UWW that can be used to jump t-t-to this thwead.

Nyew in vewsion 2.4.

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_threads pewmissions.

Wetuwn type:

bool

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() is True.

Wetuwn t-t-type:

bool

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() is True.

Wetuwn type:

bool

is_pinned()[source]

Whethew the thwead is pinnyed in a ForumChannel o-ow MediaChannel.

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:

bool

property applied_tags[source]

The tags cuwwentwy appwied to this thwead. Onwy appwicabwe to thweads in channyews of type ForumChannel ow MediaChannel.

Nyew in vewsion 2.6.

Type:

Wist[ForumTag]

permissions_for(obj, /, *, ignore_timeout=...)[source]

H-H-Handwes pewmission wesowution fow the Member ow Role.

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_for method diwectwy.

Nyote

If the thwead owiginyated fwom an Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, t-t-this method wiww nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions instead.

Changed in vewsion 2.9: Pwopewwy takes Permissions.send_messages_in_threads into 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 Member objects.

    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:

Permissions

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_messages pewmission 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 a check is nyot pwovided then aww messages awe deweted without discwiminyation.

You must have the manage_messages pewmission to dewete messages even if they awe youw own (unwess you awe a usew account). The read_message_history pewmission 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:
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 edit name, archived, auto_archive_duration and applied_tags. Nyote that i-i-if the thwead is wocked t-t-then onwy those with Permissions.manage_threads can 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 of 60, 1440, 4320, ow 10080.

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

  • pinnyed (bool) –

    Whethew to pin the thwead ow nyot. This is onwy avaiwabwe fow thweads cweated in a ForumChannel ow MediaChannel.

    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 pinned is pwovided, t-t-that wiww uvwwide the setting of ChannelFlags.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 ForumChannel ow MediaChannel.

    If moderated tags awe edited, Permissions.manage_threads pewmissions awe wequiwed.

    See awso add_tags() and remove_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:
Wetuwns:

The nyewwy edited thwead.

Wetuwn type:

Thread

await join()[source]

This function is a-a-a cowoutinye.

Joins this thwead.

You must have send_messages_in_threads to join a thwead. If the thwead is pwivate, manage_threads is 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_messages pewmission to add a usew to a pubwic thwead. If the thwead is pwivate then send_messages and eithew create_private_threads ow manage_messages pewmissions 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_threads o-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 ThreadMember fwom this thwead.

Pawametews:

membew_id (int) – The I-ID of the membew to fetch.

Waises:
Wetuwns:

The thwead membew a-asked fow.

Wetuwn type:

ThreadMember

await fetch_members()[source]

This function is a cowoutinye.

Wetwieves aww ThreadMember that awe in this thwead.

This wequiwes Intents.members to 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_threads to dewete thweads. Awtewnyativewy, you may dewete a thwead if it’s in a ForumChannel ow MediaChannel, 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 ForumChannel ow MediaChannel.

Adding tags wequiwes you to have Permissions.manage_threads pewmissions, ow be the ownyew of the thwead. Howevew, adding moderated tags awways wequiwes Permissions.manage_threads pewmissions.

Nyew in vewsion 2.6.

Pawametews:
  • *tags (abc.Snowflake) – An awgument wist of abc.Snowflake wepwesenting the ForumTags to add to t-the thwead.

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

Waises:
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 ForumChannel ow MediaChannel.

Wemoving tags wequiwes you to have Permissions.manage_threads pewmissions, ow b-be the ownyew of the thwead. Howevew, wemoving moderated tags awways wequiwes Permissions.manage_threads pewmissions.

Nyew in vewsion 2.6.

Pawametews:
  • *tags (abc.Snowflake) – An awgument wist of abc.Snowflake wepwesenting the ForumTags 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 PartialMessage fwom 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:

PartialMessage

await fetch_message(id, /)[source]

This function is a-a cowoutinye.

Wetwieves a singwe Message fwom 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:

Message

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 Message objects wetuwnyed by this method d-d-do nyot contain compwete Message.reactions data.

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file p-p-pawametew shouwd be used with a singwe File object. To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying both pawametews wiww w-w-wead to an exception.

To upwoad a singwe embed, the embed p-pawametew shouwd be used with a singwe Embed object. To upwoad muwtipwe embeds, the embeds pawametew shouwd be used with a list of Embed objects. Specifying both pawametews wiww w-w-wead t-t-to an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – The fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to u-upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object is passed at aww then the defauwts given by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to t-t-the Message to which you awe wepwying, this can b-b-be cweated using Message.to_reference() ow passed diwectwy as a Message. You can c-contwow whethew this mentions the authow of the wefewenced message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to a MessageReference using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 f-fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes t-the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed and embeds, ow you specified both view and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is too wawge, ow you t-t-twied to send v2 componyents togethew with content, embeds, stickers, ow poll.

W-W-Wetuwns:

The message that was sent.

Wetuwn type:

Message

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.

id

The thwead membew’s ID.

Type:

int

thread_id

The thwead’s ID.

Type:

int

joined_at

The time the membew joinyed the thwead in UTC.

Type:

datetime.datetime

property thread[source]

The thwead this membew bewongs to.

Type:

Thread

StageChannyew

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.

name

The channyew’s nyame.

Type:

str

guild

The guiwd the channyew bewongs t-to.

Type:

Guild

id

The channyew’s ID.

Type:

int

topic

The channyew’s topic. None if it isn’t set.

Type:

Optionyaw[str]

category_id

The categowy channyew ID this channyew bewongs to, if appwicabwe.

Type:

Optionyaw[int]

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:

int

bitrate

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

Type:

int

user_limit

The channyew’s wimit fow nyumbew of membews that can be in a stage channyew.

Type:

int

rtc_region

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

Changed in vewsion 2.5: Nyo wongew a VoiceRegion instance.

Type:

Optionyaw[str]

video_quality_mode

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

Nyew in vewsion 2.0.

Type:

VideoQualityMode

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:

bool

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_channels ow manage_messages, bypass swowmode.

Nyew in vewsion 2.9.

Type:

int

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:

ChannelType

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_channels pewmission to do this.

Changed in vewsion 2.9: Added position, category, rtc_region, video_quality_mode, bitrate, nsfw, slowmode_delay and overwrites keywowd-onwy pawametews.

Nyote

T-The cuwwent StageChannel.flags vawue won’t be cwonyed. This is a Discowd wimitation.

Wawnying

Cuwwentwy the user_limit attwibute 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) – A Mapping of tawget (eithew a wowe ow a-a membew) to PermissionOverwrite to 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:

StageChannel

is_nsfw()[source]

Whethew the channyew is mawked as NSFW.

Nyew in vewsion 2.9.

Wetuwn type:

bool

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() ow fetch_message() with the last_message_id attwibute.

Nyew in vewsion 2.9.

Wetuwns:

The wast message in this channyew ow None if nyot found.

Wetuwn type:

Optionyaw[Message]

get_partial_message(message_id, /)[source]

Cweates a PartialMessage fwom 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:

PartialMessage

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_channels pewmission to do this.

Nyew in vewsion 2.0.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • topic (str) – The stage instance’s topic.

  • pwivacy_wevew (StagePrivacyLevel) – The stage instance’s pwivacy wevew. Defauwts to StagePrivacyLevel.guild_only.

  • nyotify_evewyonye (bool) –

    Whethew to nyotify @everyone that the stage instance has stawted. Wequiwes the mention_everyone pewmission on the stage channyew. Defauwts to False.

    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_level pawametew is nyot the pwopew type.

Wetuwns:

The nyewwy cweated stage instance.

Wetuwn type:

StageInstance

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:

StageInstance

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_channels pewmission to do this.

Changed in vewsion 2.0: The topic pawametew must nyow b-b-be set via create_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 TypeError ow ValueError instead of InvalidArgument.

Changed in vewsion 2.9: T-The user_limit, nsfw, and slowmode_delay keywowd-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 to False.

  • categowy (Optionyaw[abc.Snowflake]) – The nyew categowy fow this channyew. Can be None to wemuv the categowy.

  • uvwwwites (Mapping) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to appwy to the channyew.

  • wtc_wegion (Optionyaw[Unyion[str, VoiceRegion]]) – The nyew wegion fow the stage channyew’s voice communyication. A v-v-vawue of None indicates 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 0 disabwes swowmode. The maximum vawue possibwe is 21600.

    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 None i-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_messages pewmission 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 a check i-is nyot pwovided then aww messages a-a-awe deweted without discwiminyation.

You must have manage_messages pewmission to dewete messages even if they awe youw own. read_message_history pewmission is awso nyeeded to wetwieve message histowy.

Nyew in vewsion 2.9.

Nyote

See TextChannel.purge() fow exampwes.

Pawametews:
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_webhooks pewmission 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_webhooks pewmission to do this.

Nyew in vewsion 2.9.

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

  • avataw (Optionyaw[bytes]) – The webhook’s defauwt avataw. This opewates simiwawwy to edit().

  • weason (Optionyaw[str]) – The weason fow cweating this webhook. Shows up in the audit wogs.

Waises:
W-W-Wetuwns:

The nyewwy cweated webhook.

Wetuwn type:

Webhook

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.roles attwibute.

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 VoiceClient to 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-subcwasses VoiceProtocol to connyect with. Defauwts to VoiceClient.

Waises:
Wetuwns:

A voice cwient that i-is fuwwy connyected to the voice sewvew.

Wetuwn type:

VoiceProtocol

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_invite pewmission to do this.

Pawametews:
  • max_age (int) – How wong the invite s-shouwd wast in seconds. If set to 0, then the invite doesn’t expiwe. Defauwts to 0.

  • max_uses (int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe u-unwimited uses. Defauwts to 0.

  • tempowawy (bool) – W-W-Whethew the invite gwants tempowawy membewship (i.e. they get kicked a-a-aftew they disconnyect). Defauwts t-t-to False.

  • unyique (bool) – Whethew a-a unyique invite UWW shouwd be c-cweated. Defauwts to True. If this is set to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew in vewsion 2.0.

    Changed i-in vewsion 2.9: PartyType is depwecated, and Snowflake shouwd 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:
Wetuwns:

The nyewwy cweated invite.

Wetuwn type:

Invite

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This f-function is a cowoutinye.

Dewetes the channyew.

You must have Permissions.manage_channels pewmission 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 Message fwom 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:

Message

property flags[source]

The channyew fwags fow this channyew.

Nyew i-in vewsion 2.6.

Type:

ChannelFlags

history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, othewwise False.

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_channels pewmission 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]

property mention[source]

The stwing that awwows you to mention the c-c-channyew.

Type:

str

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, edit shouwd be used instead.

You must have Permissions.manage_channels 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 TypeError ow ValueError instead of InvalidArgument.

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 with end, before, and after.

  • 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 with beginning, before, and after.

  • befowe (abc.Snowflake) – The channyew that shouwd b-be befowe ouw cuwwent channyew. This is mutuawwy excwusive w-with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew that shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and before.

  • offset (int) – The n-n-nyumbew of channyews to offset t-t-the muv by. Fow e-exampwe, an offset of 2 with beginning=True wouwd 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 the beginning, end, before, and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to muv this channyew undew. If None is 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:
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 Role ow a Member and the vawue is the uvwwwite as a PermissionOverwrite.

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.

Pawametews:

obj (Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

Wetuwns:

The pewmission uvwwwites fow this object.

Wetuwn type:

PermissionOverwrite

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes pewmission wesowution fow the Member ow Role.

This function takes into considewation the fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • C-C-Channyew uvwwides

  • Membew uvwwides

  • Timeouts

If a Role is 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 Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed a-appwications in guiwds, this method wiww nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions instead.

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 Member objects.

    Changed in vewsion 2.6: The d-d-defauwt was changed to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The w-wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

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:

bool

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file pawametew shouwd be used with a singwe File object. To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying both pawametews wiww wead to a-a-an exception.

To upwoad a singwe embed, the embed pawametew s-shouwd be used with a singwe Embed object. To upwoad muwtipwe embeds, t-the embeds pawametew shouwd be used with a list of Embed objects. Specifying both pawametews wiww wead to an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – The fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object is passed at aww then the defauwts given by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to the Message to which you awe wepwying, this can be cweated using Message.to_reference() ow passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to a MessageReference u-using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, a-a-and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed and embeds, ow you specified both view a-and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is too wawge, ow you twied to send v2 c-componyents togethew w-w-with content, embeds, stickers, ow poll.

Wetuwns:

The message that was sent.

Wetuwn type:

Message

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 target pawametew s-s-shouwd eithew be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass i-i-in keywowd awguments denyoting Permissions attwibutes. If this is donye, then you cannyot mix the keywowd awguments with the overwrite pawametew.

If the overwrite p-pawametew is None, then the pewmission uvwwwites awe deweted.

You must have Permissions.manage_roles pewmission to do t-this.

Nyote

This method wepwaces the owd uvwwwites with the onyes given.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

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 PermissionOverwrite

overwrite = 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, ow None to 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.

  • TypeEwwowoverwrite is invawid, the tawget type was nyot Role ow Member, both k-keywowd awguments and overwrite wewe 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 with and async with wowk 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 members when the membew cache is unyavaiwabwe.

Wetuwns:

T-The mapping of membew ID to a v-voice state.

Wetuwn type:

Mapping[int, VoiceState]

FowumChannyew

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.

id

The channyew’s ID.

Type:

int

name

The c-channyew’s nyame.

Type:

str

guild

The g-guiwd the channyew bewongs to.

T-Type:

Guild

topic

The channyew’s topic. None if it isn’t set.

Type:

Optionyaw[str]

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:

int

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:

bool

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:

int

slowmode_delay

The nyumbew of seconds a membew must wait between cweating thweads in this channyew.

A vawue of 0 denyotes that it is disabwed. Bots, and usews with manage_channels ow manage_messages, bypass swowmode.

See awso default_thread_slowmode_delay.

Type:

int

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 0 denyotes that it is disabwed. Bots, and usews with manage_channels ow manage_messages, bypass swowmode.

Nyew in vewsion 2.6.

Type:

int

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:

ThreadLayout

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 with and async with wowk 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:

ChannelType

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_channels pewmission to do this.

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

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 to False.

  • categowy (Optionyaw[abc.Snowflake]) – The nyew c-c-categowy fow this channyew. Can be None to 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 of 0 ow None disabwes swowmode. The maximum vawue possibwe is 21600.

  • 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 0 ow None disabwes swowmode. The maximum vawue possibwe is 21600.

    Nyew in vewsion 2.6.

  • uvwwwites (Mapping) – A Mapping of tawget (eithew a wowe ow a membew) t-to PermissionOverwrite to 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 of 60, 1440, 4320, ow 10080.

  • fwags (ChannelFlags) –

    The nyew fwags to set fow this channyew. This wiww uvwwwite any existing fwags set on this channyew. If pawametew require_tag is pwovided, that wiww uvwwide the setting of ChannelFlags.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 ForumTag fow 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 None is 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_channels pewmission 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_order and overwrites keywowd-onwy pawametews.

Changed in vewsion 2.10: Added default_layout pawametew.

Nyote

The cuwwent ForumChannel.flags vawue 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) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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:

MediaChannel

archived_threads(*, limit=50, before=None)[source]

Wetuwns an AsyncIterator that itewates uvw aww awchived thweads in the channyew.

You must have read_message_history pewmission to use this.

Pawametews:
  • wimit (Optionyaw[int]) – The nyumbew of thweads t-to wetwieve. If None, 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.roles attwibute.

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_invite pewmission to do this.

Pawametews:
  • max_age (int) – How wong the invite s-s-shouwd wast in seconds. If set to 0, then the invite doesn’t expiwe. Defauwts t-to 0.

  • max_uses (int) – How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts to 0.

  • tempowawy (bool) – Whethew the invite gwants t-t-tempowawy membewship (i.e. they get kicked aftew they disconnyect). Defauwts to False.

  • unyique (bool) – W-Whethew a unyique invite UWW s-s-shouwd be cweated. Defauwts to True. If this is set to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew in vewsion 2.0.

    Changed in vewsion 2.9: PartyType is depwecated, and Snowflake shouwd 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:

Invite

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_threads pewmission to do this.

At w-weast onye of content, embed/embeds, file/files, stickers, components, ow view must be pwovided.

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

Changed in vewsion 2.6: The content p-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-of 60, 1440, 4320, ow 10080.

  • swowmode_deway (Optionyaw[int]) – Specifies the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If set to None ow nyot pwovided, swowmode is inhewited fwom the pawent’s default_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 the embeds pawametew.

  • embeds (Wist[Embed]) – A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the embed pawametew.

  • suppwess_embeds (bool) – Whethew to suppwess embeds f-f-fow the message. This hides aww the embeds fwom the UI if set to True.

  • fwags (MessageFlags) –

    The fwags to set f-fow this message. Onwy suppress_embeds and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.suppress_embeds.

    Nyew in vewsion 2.9.

  • fiwe (File) – The fiwe to upwoad. This c-c-cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A w-w-wist of fiwes t-to upwoad. Must b-be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 with Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set in Client.allowed_mentions. If nyo object is passed at aww then the defauwts given by Client.allowed_mentions awe used instead.

  • view (ui.View) – A Discowd UI View to add to the message. This cannyot be mixed with components.

  • 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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, and stickers fiewds.

  • 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 file and files, ow you specified both embed and embeds, ow you specified b-b-both view and components, ow you have passed an object that is nyot File to file ow files.

  • VawueEwwow – Specified mowe than 10 embeds, ow mowe than 10 fiwes, ow you twied to send v2 c-componyents togethew with content, embeds, ow stickers.

Wetuwns:

A-A NamedTuple with the nyewwy cweated thwead and the message sent in it.

Wetuwn type:

ThreadWithMessage

await create_webhook(*, name, avatar=None, reason=None)[source]

This function is a cowoutinye.

Cweates a webhook fow this channyew.

You must have manage_webhooks pewmission to do this.

Nyew in vewsion 2.6.

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

  • avataw (Optionyaw[bytes]) – The webhook’s defauwt avataw. This opewates simiwawwy to edit().

  • weason (Optionyaw[str]) – The weason fow cweating this webhook. Shows up in the audit wogs.

Waises:
Wetuwns:

The nyewwy cweated webhook.

Wetuwn type:

Webhook

property created_at[source]

Wetuwns the channyew’s c-c-cweation time in UTC.

Type:

datetime.datetime

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 name if it is a custom PartialEmoji.

Nyew in vewsion 2.6.

await delete(*, reason=None)[source]

This function i-is a cowoutinye.

Dewetes the channyew.

You must have Permissions.manage_channels pewmission 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.

property flags[source]

The channyew fwags f-f-fow this channyew.

Nyew in v-v-vewsion 2.6.

Type:

ChannelFlags

get_tag(tag_id, /)[source]

Wetuwns a thwead tag with the given ID.

Nyew in vewsion 2.6.

Pawametews:

tag_id (int) – The ID to seawch fow.

Wetuwns:

The tag with the given ID, ow None if nyot found.

Wetuwn type:

Optionyaw[ForumTag]

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.

Pawametews:

nyame (str) – The nyame to seawch fow.

Wetuwns:

The tag with the given nyame, ow None if nyot found.

Wetuwn type:

Optionyaw[ForumTag]

get_thread(thread_id, /)[source]

Wetuwns a thwead with the given ID.

Pawametews:

thwead_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed thwead of None if nyot found.

Wetuwn type:

Optionyaw[Thread]

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_channels pewmission 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]

is_nsfw()[source]

Whethew the channyew i-is mawked as NSFW.

W-W-Wetuwn type:

bool

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 the last_thread_id attwibute.

Wetuwns:

The wast cweated thwead in this channyew ow None if nyot found.

Wetuwn type:

Optionyaw[Thread]

property members[source]

Wetuwns aww membews that can see this channyew.

Type:

Wist[Member]

property mention[source]

The stwing that awwows you to mention the channyew.

Type:

str

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, edit shouwd be used instead.

You must have Permissions.manage_channels pewmission 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 TypeError ow ValueError instead of InvalidArgument.

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 with end, before, and after.

  • 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 with beginning, before, and after.

  • befowe (abc.Snowflake) – The channyew that shouwd b-b-be befowe ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew that shouwd be a-aftew ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and before.

  • offset (int) – The nyumbew of channyews to offset the muv by. Fow exampwe, an offset o-o-of 2 w-w-with beginning=True wouwd 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 the beginning, end, before, a-a-and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to muv this channyew undew. If None is 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 Role ow a Member and the vawue is the uvwwwite as a PermissionOverwrite.

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.

Pawametews:

obj (Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

W-W-Wetuwns:

The pewmission uvwwwites fow this object.

Wetuwn type:

PermissionOverwrite

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes pewmission wesowution fow the Member ow Role.

This function takes into considewation the fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • Channyew uvwwides

  • Membew uvwwides

  • Timeouts

I-If a Role is 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 Interaction and the guild attwibute 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-using Interaction.permissions ow app_permissions instead.

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 Member objects.

    Changed in vewsion 2.6: The defauwt was changed to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

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:

bool

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:

bool

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 target pawametew shouwd eithew b-b-be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyoting Permissions attwibutes. If this is donye, then you cannyot mix the keywowd awguments with the overwrite pawametew.

If the overwrite pawametew is None, then the pewmission uvwwwites awe deweted.

You must have Permissions.manage_roles pewmission to do this.

Nyote

This method wepwaces the owd u-uvwwwites with the onyes given.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

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 PermissionOverwrite

overwrite = 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, ow None to 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-TypeEwwowoverwrite is invawid, the tawget type was nyot Role ow Member, both k-keywowd awguments and overwrite wewe pwovided, ow invawid pewmissions wewe pwovided as keywowd awguments.

property threads[source]

Wetuwns aww the thweads that you can see.

Type:

Wist[Thread]

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_webhooks pewmission to use this.

Nyew in vewsion 2.6.

Waises:

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

Wetuwns:

The wist of webhooks t-t-this channyew h-has.

Wetuwn type:

Wist[Webhook]

MediaChannyew

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.

id

The channyew’s ID.

T-Type:

int

name

The channyew’s nyame.

Type:

str

guild

The guiwd the channyew bewongs to.

Type:

Guild

topic

The channyew’s topic. None if it isn’t s-s-set.

T-T-Type:

Optionyaw[str]

category_id

The categowy channyew ID this channyew bewongs to, if appwicabwe.

Type:

Optionyaw[int]

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:

int

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:

bool

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:

int

slowmode_delay

The nyumbew of seconds a membew must wait between cweating thweads in this channyew.

A-A-A vawue of 0 denyotes that it is disabwed. Bots, a-and usews with manage_channels ow manage_messages, b-bypass swowmode.

See awso default_thread_slowmode_delay.

Type:

int

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 0 denyotes that it is disabwed. Bots, and usews with manage_channels ow manage_messages, bypass swowmode.

T-Type:

int

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 with and async with wowk 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:

ChannelType

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:

bool

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_channels pewmission 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 to False.

  • categowy (Optionyaw[abc.Snowflake]) – The nyew categowy f-f-fow this channyew. Can be None to 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 of 0 ow None disabwes s-swowmode. The maximum vawue possibwe is 21600.

  • 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 of 0 ow None disabwes swowmode. The maximum vawue possibwe is 21600.

  • uvwwwites (Mapping) – A Mapping of tawget (eithew a wowe ow a membew) to PermissionOverwrite to 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 of 60, 1440, 4320, ow 10080.

  • fwags (ChannelFlags) – The nyew fwags to set fow this channyew. This wiww uvwwwite any existing fwags set on this channyew. If pawametew require_tag is pwovided, that wiww uvwwide the setting of ChannelFlags.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 ForumTag fow 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 None i-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_channels pewmission to do this.

Nyote

The c-c-cuwwent MediaChannel.flags vawue 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) – A Mapping of tawget (eithew a wowe o-o-ow a membew) to PermissionOverwrite to 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:

MediaChannel

archived_threads(*, limit=50, before=None)[source]

W-Wetuwns an AsyncIterator that itewates uvw a-aww awchived thweads in the channyew.

You must h-h-have read_message_history pewmission to use this.

Pawametews:
  • w-w-wimit (Optionyaw[int]) – The nyumbew of thweads to wetwieve. If None, 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.roles attwibute.

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_invite pewmission to do this.

P-Pawametews:
  • max_age (int) – How wong the invite shouwd wast in seconds. If set to 0, then the invite doesn’t expiwe. Defauwts to 0.

  • max_uses (int) – H-H-How many uses the invite couwd be used fow. If it’s 0 then thewe awe unwimited uses. Defauwts to 0.

  • tempowawy (bool) – Whethew the invite gwants tempowawy m-membewship (i.e. they get kicked aftew they disconnyect). Defauwts to False.

  • unyique (bool) – Whethew a unyique invite UWW shouwd be cweated. Defauwts to True. If this is set to False then 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_type is InviteTarget.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_type is InviteTarget.embedded_application.

    Nyew in vewsion 2.0.

    Changed in vewsion 2.9: PartyType i-is depwecated, and Snowflake shouwd 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:

Invite

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_threads pewmission to do this.

At weast onye of content, embed/embeds, file/files, stickers, components, ow view must be p-p-pwovided.

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

Changed in vewsion 2.6: The content pawametew 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 of 60, 1440, 4320, ow 10080.

  • swowmode_deway (Optionyaw[int]) – Specifies the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of 0 disabwes swowmode. The maximum vawue possibwe is 21600. If set to None ow nyot pwovided, swowmode is inhewited fwom the pawent’s default_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 the embeds pawametew.

  • e-embeds (Wist[Embed]) – A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the embed pawametew.

  • suppwess_embeds (bool) – Whethew to suppwess embeds fow the message. This hides aww the embeds fwom the UI if set to True.

  • fwags (MessageFlags) –

    The fwags to set fow this message. Onwy suppress_embeds and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.suppress_embeds.

    Nyew in vewsion 2.9.

  • fiwe (File) – The fiwe to upwoad. This cannyot b-b-be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 with Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set in Client.allowed_mentions. If nyo o-object is passed at aww then the defauwts given by Client.allowed_mentions awe used instead.

  • view (ui.View) – A Discowd UI V-V-View to add to the message. This cannyot be mixed with components.

  • 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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, and stickers fiewds.

  • 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 file and files, ow you specified both embed a-and embeds, ow you specified both view and components, ow you have passed an object that i-is nyot File to file ow files.

  • VawueEwwow – Specified mowe than 10 embeds, ow mowe than 10 fiwes, ow you twied to send v2 componyents togethew with content, embeds, ow stickers.

Wetuwns:

A NamedTuple with the nyewwy cweated thwead and the message sent in it.

Wetuwn type:

ThreadWithMessage

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_webhooks pewmission to do this.

Nyew in vewsion 2.6.

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

  • avataw (Optionyaw[bytes]) – The webhook’s defauwt avataw. This opewates simiwawwy to edit().

  • weason (Optionyaw[str]) – The weason fow cweating this webhook. Shows up in the audit wogs.

Waises:
Wetuwns:

The nyewwy cweated webhook.

Wetuwn type:

Webhook

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

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 name if it is a custom PartialEmoji.

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_channels pewmission 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.

property flags[source]

The channyew fwags fow this channyew.

Nyew in vewsion 2.6.

Type:

ChannelFlags

get_tag(tag_id, /)[source]

Wetuwns a thwead tag with the given ID.

Nyew in vewsion 2.6.

Pawametews:

tag_id (int) – The ID to seawch fow.

Wetuwns:

The tag with the given ID, ow None if nyot found.

Wetuwn type:

Optionyaw[ForumTag]

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.

Pawametews:

nyame (str) – The nyame to seawch fow.

Wetuwns:

The tag with the given nyame, ow None if nyot found.

Wetuwn type:

Optionyaw[ForumTag]

get_thread(thread_id, /)[source]

Wetuwns a thwead with the given ID.

Pawametews:

thwead_id (int) – The ID to seawch fow.

Wetuwns:

The wetuwnyed thwead of None if n-n-nyot found.

Wetuwn type:

Optionyaw[Thread]

await invites()[source]

This function is a cowoutinye.

Wetuwns a wist of aww active instant invites fwom this channyew.

You must have Permissions.manage_channels pewmission 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]

is_nsfw()[source]

Whethew the channyew is mawked as NSFW.

Wetuwn type:

bool

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 the last_thread_id attwibute.

Wetuwns:

The wast cweated thwead in this channyew ow None i-if nyot found.

Wetuwn type:

Optionyaw[Thread]

property members[source]

Wetuwns aww membews that can see this channyew.

Type:

Wist[Member]

property mention[source]

The stwing that a-awwows you to mention the channyew.

Type:

str

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, edit shouwd be used instead.

You must have Permissions.manage_channels 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 i-i-in v-v-vewsion 2.6: Waises TypeError o-o-ow ValueError instead of InvalidArgument.

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 with end, before, and after.

  • end (bool) – Whethew to muv the channyew to the end of the channyew wist (ow categowy if given). This is mutuawwy e-excwusive with beginning, before, and after.

  • befowe (abc.Snowflake) – The c-channyew that shouwd be befowe ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and after.

  • aftew (abc.Snowflake) – The channyew that s-shouwd be aftew ouw cuwwent channyew. This is mutuawwy excwusive with beginning, end, and before.

  • offset (int) – The nyumbew of c-channyews t-t-to offset the muv b-b-by. Fow exampwe, an offset of 2 with beginning=True wouwd 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 the beginning, end, before, and after pawametews.

  • categowy (Optionyaw[abc.Snowflake]) – The categowy to muv this channyew undew. If None 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. 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 Role o-o-ow a Member and the vawue is the uvwwwite as a PermissionOverwrite.

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.

Pawametews:

obj (U-U-Unyion[Role, abc.User]) – The wowe ow usew denyoting whose uvwwwite to get.

Wetuwns:

The pewmission uvwwwites fow t-this object.

W-W-Wetuwn type:

PermissionOverwrite

permissions_for(obj, /, *, ignore_timeout=...)[source]

Handwes pewmission wesowution fow the Member ow Role.

This function takes into considewation the fowwowing cases:

  • Guiwd ownyew

  • Guiwd wowes

  • Channyew uvwwides

  • Membew uvwwides

  • Timeouts

If a-a Role is 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 Interaction and the guild attwibute is unyavaiwabwe, such as with usew-instawwed appwications in guiwds, this method wiww n-n-nyot wowk due to an API wimitation. Considew using Interaction.permissions ow app_permissions instead.

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 Member objects.

    Changed in vewsion 2.6: The defauwt was changed to False.

Waises:

TypeEwwowignore_timeout is onwy suppowted fow Member objects.

Wetuwns:

The wesowved pewmissions fow the membew ow wowe.

Wetuwn type:

Permissions

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:

bool

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:

bool

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 target pawametew shouwd eithew be a Member ow a Role that bewongs to guiwd.

The overwrite pawametew, if given, must eithew be None ow PermissionOverwrite. Fow convenyience, you can pass in keywowd awguments denyoting Permissions attwibutes. If this is donye, then you cannyot mix the keywowd a-a-awguments with the overwrite pawametew.

If the overwrite pawametew i-is None, then the pewmission uvwwwites awe deweted.

You must have Permissions.manage_roles pewmission to do this.

Nyote

This method wepwaces t-the owd uvwwwites with the onyes given.

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

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 PermissionOverwrite

overwrite = 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, ow None to 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.

  • TypeEwwowoverwrite is i-i-invawid, the tawget type was nyot Role ow Member, both keywowd awguments and overwrite wewe pwovided, ow invawid pewmissions w-w-wewe pwovided as keywowd a-a-awguments.

property threads[source]

Wetuwns aww the thweads that you can see.

Type:

Wist[Thread]

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_webhooks pewmission to use this.

Nyew in vewsion 2.6.

Waises:

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

Wetuwns:

T-T-The wist of webhooks this channyew has.

Wetuwn type:

W-W-Wist[Webhook]

DMChannyew

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:

ClientUser

id

The diwect message channyew ID.

T-T-Type:

int

last_pin_timestamp

The time the most wecent message was pinnyed, ow None if 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 AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, othewwise False.

Waises:
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 with and async with wowk 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:

ChannelType

property created_at[source]

W-Wetuwns the diwect message channyew’s cweation time in UTC.

Type:

datetime.datetime

property jump_url[source]

A UWW that can be used to jump to this channyew.

Nyew in vewsion 2.4.

await fetch_message(id, /)[source]

This function is a cowoutinye.

Wetwieves a singwe Message fwom 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:

Message

property flags[source]

T-The channyew fwags f-fow this channyew.

Nyew in vewsion 2.6.

Type:

ChannelFlags

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 Message objects wetuwnyed by this method do nyot contain compwete Message.reactions data.

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file p-pawametew shouwd be used with a singwe File object. To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying b-both pawametews wiww w-wead to an exception.

To upwoad a singwe embed, the embed pawametew shouwd be used with a singwe Embed object. To upwoad muwtipwe embeds, the embeds pawametew shouwd be used with a list of Embed objects. Specifying both pawametews wiww wead to an exception.

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

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 the embeds pawametew.

  • embeds (Wist[Embed]) –

    A wist of embeds to send with the content. Must be a maximum of 10. This cannyot be mixed with the embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – The fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object is passed a-a-at aww t-t-then the defauwts given by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to the Message to which you awe wepwying, t-t-this can be cweated using Message.to_reference() ow passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced m-message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the m-m-message to a MessageReference using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe s-s-suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed and embeds, ow you specified both view and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is too wawge, ow you twied to send v2 componyents togethew w-with content, embeds, stickers, ow poll.

Wetuwns:

The message that was sent.

Wetuwn type:

Message

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 to True.

Pawametews:
  • obj (User) – The usew t-t-to check pewmissions fow. This pawametew is i-i-ignyowed but kept fow compatibiwity with othew permissions_for methods.

  • ignyowe_timeout (bool) – Whethew to ignyowe the guiwd timeout when checking pewmsisions. This pawametew is ignyowed but kept fow compatibiwity with othew permissions_for methods.

Wetuwns:

The wesowved pewmissions.

Wetuwn type:

Permissions

get_partial_message(message_id, /)[source]

Cweates a PartialMessage fwom 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:

PartialMessage

GwoupChannyew

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:

ClientUser

id

The gwoup channyew ID.

Type:

int

owner

The usew that owns the gwoup channyew.

Type:

Optionyaw[User]

owner_id

The ownyew ID that owns the gwoup channyew.

Nyew in vewsion 2.0.

Type:

int

name

The gwoup channyew’s nyame if pwovided.

Type:

Optionyaw[str]

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must have Permissions.read_message_history pewmission 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. If None, 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 to True, wetuwn messages in owdest->nyewest owdew. D-Defauwts to True if after is specified, othewwise False.

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 with and async with wowk 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 Message fwom 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:

Message

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 Message objects wetuwnyed by this method do nyot contain compwete Message.reactions data.

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, poll ow view must be pwovided.

To upwoad a singwe fiwe, the file pawametew shouwd be used with a singwe File object. To upwoad m-muwtipwe fiwes, the files pawametew shouwd be used with a-a-a list o-o-of File objects. S-Specifying both pawametews wiww wead to an exception.

To upwoad a singwe embed, the embed pawametew shouwd be used w-with a singwe Embed object. To upwoad muwtipwe embeds, the embeds pawametew shouwd be u-u-used with a list of Embed objects. Specifying both pawametews wiww wead to an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – The f-f-fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to upwoad. Must be a maximum o-of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo o-object is passed at aww then the defauwts given b-by Client.allowed_mentions awe used instead.

    Nyew in vewsion 1.4.

  • w-wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to the Message to which you awe wepwying, this can be cweated using Message.to_reference() ow p-p-passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage wiww onwy awwow wepwies. To fowwawd a message you must expwicitwy twansfowm the message to a MessageReference using Message.to_reference() and specify t-t-the MessageReferenceType, ow use Message.forward().

  • mention_authow (O-O-Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is p-p-pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed and embeds, ow you specified both view and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is too wawge, o-ow you twied to send v2 componyents togethew with content, embeds, stickers, ow poll.

Wetuwns:

The message that was sent.

Wetuwn type:

Message

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:

ChannelType

property icon[source]

Wetuwns the channyew’s icon a-asset if avaiwabwe.

Type:

Optionyaw[Asset]

property created_at[source]

Wetuwns the channyew’s cweation time in UTC.

Type:

datetime.datetime

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 to True.

This awso checks the kick_membews pewmission if the usew is the ownyew.

Pawametews:
  • obj (Snowflake) – The usew to check pewmissions fow.

  • ignyowe_timeout (bool) – Whethew to ignyowe the guiwd timeout when checking pewmsisions. This pawametew is ignyowed but kept fow compatibiwity w-w-with othew permissions_for methods.

Wetuwns:

The wesowved pewmissions fow the usew.

Wetuwn type:

Permissions

get_partial_message(message_id, /)[source]

Cweates a PartialMessage fwom 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:

PartialMessage

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_id

The ID of the thwead that was deweted.

Type:

int

guild_id

The ID of the guiwd the t-t-thwead was deweted in.

Type:

int

thread_type

The type of the deweted thwead.

Type:

ChannelType

parent_id

The I-ID of the channyew the thwead bewonged to.

Type:

int

thread

The thwead, if it couwd be found in the intewnyaw cache.

Type:

Optionyaw[Thread]

WawThweadMembewWemuvEvent

class disnake.RawThreadMemberRemoveEvent[source]

Wepwesents the event paywoad fow an on_raw_thread_member_remove() event.

N-Nyew in vewsion 2.5.

thread

The Thwead that the membew was wemuvd fwom

Type:

Thread

member_id

The ID of the wemuvd membew.

Type:

int

cached_member

The membew, if they couwd be f-found in the intewnyaw cache.

Type:

Optionyaw[ThreadMember]

Data Cwasses

PawtiawMessageabwe

Attwibutes
Methods
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.

id

The channyew ID associated w-w-with this pawtiaw messageabwe.

Type:

int

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 Message fwom 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:

Message

history(*, limit=100, before=None, after=None, around=None, oldest_first=None)[source]

Wetuwns an AsyncIterator that enyabwes weceiving the destinyation’s message histowy.

You must h-h-have Permissions.read_message_history pewmission 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. If None, 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-to True, wetuwn messages in owdest->nyewest owdew. Defauwts to True if after is specified, o-o-othewwise False.

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 Message objects wetuwnyed by this method do nyot c-c-contain compwete Message.reactions data.

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, poll ow view must b-be pwovided.

To upwoad a singwe fiwe, the file pawametew shouwd be used with a singwe File object. To upwoad muwtipwe fiwes, the files pawametew shouwd be used with a list of File objects. Specifying both pawametews wiww wead to an exception.

To upwoad a singwe embed, the embed pawametew shouwd be used with a singwe Embed object. To upwoad muwtipwe embeds, t-the embeds pawametew shouwd be used with a list of Embed objects. Specifying both pawametews wiww wead to an exception.

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

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 the embeds pawametew.

  • 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 embed pawametew.

    Nyew in vewsion 2.0.

  • fiwe (File) – T-T-The f-fiwe to upwoad. This cannyot be mixed with the files pawametew.

  • fiwes (Wist[File]) – A wist of fiwes to upwoad. Must be a maximum of 10. This cannyot be mixed with the file pawametew.

  • 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 in Client.allowed_mentions. If nyo object is passed at aww then the defauwts given by Client.allowed_mentions awe u-u-used instead.

    Nyew in vewsion 1.4.

  • wefewence (Unyion[Message, MessageReference, PartialMessage]) –

    A wefewence to the Message to which you awe wepwying, this can be cweated u-using Message.to_reference() ow passed diwectwy as a Message. You can contwow whethew this mentions the authow of the wefewenced message using the AllowedMentions.replied_user attwibute of allowed_mentions ow by setting mention_author.

    Nyew in v-vewsion 1.6.

    Nyote

    Passing a Message ow PartialMessage w-w-wiww onwy awwow w-wepwies. To fowwawd a message you must expwicitwy twansfowm the message to a MessageReference using Message.to_reference() and specify the MessageReferenceType, ow use Message.forward().

  • mention_authow (Optionyaw[bool]) –

    If set, uvwwides the AllowedMentions.replied_user attwibute of allowed_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_v2 fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes the content, embeds, stickers, and poll fiewds.

  • 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, and is_components_v2 awe suppowted.

    If pawametew suppress_embeds is pwovided, that wiww uvwwide the setting of MessageFlags.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 file and files, ow you specified both embed a-a-and embeds, ow you specified both view and components, ow the reference object is nyot a Message, MessageReference ow PartialMessage.

  • VawueEwwow – The files ow embeds wist is too wawge, ow you twied to send v2 componyents togethew with content, embeds, stickers, ow poll.

W-Wetuwns:

The message that was sent.

Wetuwn type:

Message

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 with and async with wowk 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 PartialMessage fwom 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:

PartialMessage

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 y invewted 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:

int

pinned

Wetuwns True if the thwead i-is pinnyed.

This onwy appwies to thweads that awe pawt of a ForumChannel ow MediaChannel.

Type:

bool

require_tag

Wetuwns True if the channyew wequiwes aww nyewwy cweated thweads to have a tag.

This onwy appwies to channyews of types ForumChannel ow MediaChannel.

Nyew in v-v-vewsion 2.6.

Type:

bool

hide_media_download_options

Wetuwns True if 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:

bool

FowumTag

Methods
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)
id

The tag’s ID. N-N-Nyote t-that if this tag was manyuawwy constwucted, this wiww be 0.

Type:

int

name

The tag’s nyame.

Type:

str

moderated

Whethew onwy modewatows can add this t-tag to thweads ow wemuv it. Defauwts to False.

Type:

bool

emoji

The emoji associated w-w-with this tag, if any. Due to a Discowd wimitation, this wiww have an empty name if it is a c-custom PartialEmoji.

Type:

Optionyaw[Unyion[Emoji, PartialEmoji]]

property created_at[source]

Wetuwns the tag’s cweation time in UTC.

Nyew in vewsion 2.10.

Type:

datetime.datetime

with_changes(*, name=..., emoji=..., moderated=...)[source]

Wetuwns a nyew i-i-instance with the given changes appwied, fow easy use with ForumChannel.edit() ow MediaChannel.edit(). Aww othew fiewds wiww be kept intact.

Wetuwns:

The nyew tag instance.

Wetuwn t-type:

ForumTag

ThweadWithMessage

class disnake.ThreadWithMessage[source]

A NamedTuple which wepwesents a thwead and message wetuwnyed fwom ForumChannel.create_thread().

thread

The cweated thwead.

T-T-Type:

Thread

message

The inyitiaw m-m-message in the thwead.

Type:

Message

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

class disnake.VideoQualityMode[source]

Wepwesents the c-c-camewa video quawity mode fow voice channyew p-pawticipants.

N-Nyew in vewsion 2.0.

auto

Wepwesents auto camewa video quawity.

full

Wepwesents fuww camewa video quawity.

ThweadSowtOwdew

class disnake.ThreadSortOrder[source]

Wepwesents the sowt owdew of thweads in a ForumChannel ow MediaChannel.

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).

ThweadWayout

class disnake.ThreadLayout[source]

Wepwesents the wayout of thweads in ForumChannels.

N-N-Nyew in vewsion 2.8.

not_set

Nyo pwefewwed wayout has been s-set.

list_view

Dispway fowum thweads in a text-focused wist.

gallery_view

Dispway fowum thweads in a media-focused cowwection of tiwes.

Events