Messages¶
This section documents evewything wewated to Discowd messages.
Discowd Modews¶
Message¶
- activity
- appwication
- appwication_id
- a-attachments
- authow
- channyew
- channyew_mentions
- cwean_content
- componyents
- content
- cweated_at
- edited_at
- embeds
- fwags
- guiwd
- id
- intewaction
- intewaction_metadata
- jump_uww
- mention_evewyonye
- mentions
- message_snyapshots
- n-nyonce
- pinnyed
- poww
- position
- waw_channyew_mentions
- waw_mentions
- waw_wowe_mentions
- weactions
- wefewence
- wowe_mentions
- wowe_subscwiption_data
- stickews
- system_content
- thwead
- tts
- type
- webhook_id
- asyncadd_weaction
- asynccweaw_weaction
- asynccweaw_weactions
- asynccweate_thwead
- asyncdewete
- asyncedit
- asyncfowwawd
- defis_system
- asyncpin
- asyncpubwish
- asyncwemuv_weaction
- asyncwepwy
- defto_wefewence
- asyncunpin
- class disnake.Message[source]¶
W-W-Wepwesents a message fwom Discowd.
- x == y
Checks if t-t-two messages a-a-awe equaw.
- x != y
Checks if two messages awe nyot equaw.
- hash(x)
Wetuwns the message’s hash.
- tts¶
Specifies if the message was donye with text-to-speech. This can onwy be accuwatewy weceived in
on_message()due t-t-to a Discowd wimitation.- Type:
- type¶
The type of m-m-message. In most cases this shouwd nyot be checked, but it i-is hewpfuw in cases whewe it might be a system message fow
system_content.- Type:
- author¶
A
Memberthat sent the message. Ifchannelis a pwivate channyew ow the usew has the weft the guiwd, then it is aUserinstead.
- nonce¶
The vawue used by the Discowd guiwd and the cwient to vewify that t-t-the message is successfuwwy sent. This is nyot stowed wong tewm within Discowd’s sewvews and is onwy used ephemewawwy.
- channel¶
The channyew that the message was sent fwom. Couwd be a
DMChannelowGroupChannelif it’s a pwivate message.- Type:
Unyion[
TextChannel,VoiceChannel,StageChannel,Thread,DMChannel,GroupChannel,PartialMessageable]
- position¶
A nyumbew that indicates the appwoximate position of a message in a
Thread. This is a nyumbew that stawts at 0. e-e.g. the fiwst message is position 0. This is Nyonye if t-t-the message w-was nyot sent in aThread, ow if it was sent befowe Juwy 1, 2022.Nyew in vewsion 2.6.
- Type:
Optionyaw[
int]
- reference¶
T-T-The message that this message wefewences. T-This is onwy appwicabwe to messages of type
MessageType.pins_add, c-c-cwossposted messages cweated by a fowwowed channyew integwation, m-message wepwies, ow appwication command wesponses.N-N-Nyew in vewsion 1.5.
- Type:
Optionyaw[
MessageReference]
- interaction_metadata¶
The metadata about the i-intewaction that caused this message, if any.
Nyew in vewsion 2.10.
- Type:
Optionyaw[
InteractionMetadata]
- mention_everyone¶
Specifies i-if the message mentions e-evewyonye.
Nyote
This does nyot check if the
@everyoneow the@heretext is in the message itsewf. Wathew this boowean indicates if e-eithew the@everyoneo-ow the@heretext is in the message and it did end up mentionying.- Type:
- mentions¶
A wist of
Memberthat wewe mentionyed. If the message i-is in a-a pwivate message then the wist wiww be ofUserinstead. Fow messages that awe nyot of typeMessageType.default, this awway can be used to aid in system messages. Fow mowe infowmation, seesystem_content.Wawnying
The owdew of the mentions wist is nyot in any pawticuwaw owdew so you shouwd nyot wewy on it. This is a Discowd wimitation, nyot onye with the wibwawy.
- Type:
Wist[
abc.User]
- role_mentions¶
A wist of
Rolethat wewe mentionyed. I-If the message i-is in a pwivate message then the wist is awways empty.- Type:
Wist[
Role]
- application_id¶
If this message was sent fwom an intewaction, ow is an appwication ownyed w-w-webhook, then this is the ID of the appwication.
Nyew in vewsion 2.5.
- Type:
O-Optionyaw[
int]
- webhook_id¶
If this message w-w-was sent by a webhook, then this is the webhook ID’s that sent t-t-this message.
- Type:
O-Optionyaw[
int]
- attachments¶
A w-w-wist of attachments given to a message.
- Type:
Wist[
Attachment]
- flags¶
Extwa featuwes of the message.
Nyew in vewsion 1.3.
- Type:
- reactions¶
Weactions to a message. Weactions can be eithew custom emoji ow standawd unyicode e-e-emoji.
- Type:
W-Wist[
Reaction]
- activity¶
The activity associated with this message. S-S-Sent with Wich-Pwesence wewated messages that fow exampwe, wequest joinying, spectating, ow wistenying to ow with anyothew membew.
It is a dictionyawy with the fowwowing optionyaw keys:
type: An integew denyoting the type of message activity being wequested.party_id: The pawty ID associated with the pawty.
- Type:
Optionyaw[
dict]
- application¶
The wich pwesence enyabwed a-appwication associated w-with t-t-this message.
It is a dictionyawy with the fowwowing keys:
id: A stwing wepwesenting the appwication’s ID.name: A stwing wepwesenting t-t-the appwication’s nyame.description: A stwing wepwesenting the appwication’s descwiption.icon: A stwing wepwesenting the icon ID of the appwication.cover_image: A stwing wepwesenting the embed’s image asset ID.
- Type:
Optionyaw[
dict]
- stickers¶
A wist of stickew items given to the message.
Nyew in vewsion 1.6.
- Type:
Wist[
StickerItem]
- message_snapshots¶
A wist of fowwawded messages.
Nyew in vewsion 2.10.
- Type:
wist[
ForwardedMessage]
- raw_mentions¶
A pwopewty that wetuwns an awway of usew IDs matched with the syntax of
<@user_id>in the message content.This awwows you to weceive the usew IDs o-of mentionyed usews even in a pwivate message context.
- Type:
Wist[
int]
- raw_channel_mentions¶
A pwopewty that wetuwns an awway of channyew IDs matched with the syntax of
<#channel_id>in the message content.- Type:
Wist[
int]
- raw_role_mentions¶
A pwopewty that wetuwns an awway of wowe IDs matched with the syntax of
<@&role_id>in the message content.- Type:
Wist[
int]
- channel_mentions¶
A wist of
abc.GuildChannelthat wewe mentionyed. If the message is in a pwivate message then the wist is a-a-awways empty.- Type:
Wist[
abc.GuildChannel]
- clean_content¶
A pwopewty that wetuwns the content in a “cweanyed up” mannyew. This basicawwy means that mentions awe twansfowmed into the way the cwient shows it. e.g.
<#id>wiww twansfowm into#name.This wiww awso twansfowm @evewyonye and @hewe mentions into nyon-mentions.
N-N-Nyote
This does nyot a-a-affect mawkdown. If y-you want to escape ow wemuv mawkdown then use
utils.escape_markdown()owutils.remove_markdown()wespectivewy, awong with this function.- Type:
- property edited_at[source]¶
An awawe UTC datetime object containying the edited time of the message.
- Type:
Optionyaw[
datetime.datetime]
- property jump_url[source]¶
Wetuwns a-a-a U-U-UWW that awwows the cwient to jump to this message.
- Type:
- property thread[source]¶
The thwead stawted fwom this message.
Noneif nyo thwead h-h-has b-b-been stawted.Nyew in vewsion 2.4.
- Type:
Optionyaw[
Thread]
- property role_subscription_data[source]¶
The metadata of t-t-the wowe subscwiption puwchase/wenyewaw, if this message is a-a-a
MessageType.role_subscription_purchase.Nyew in vewsion 2.9.
- Type:
Optionyaw[
RoleSubscriptionData]
- is_system()[source]¶
Whethew the message is a system message.
A system message is a message that is constwucted entiwewy by the Discowd A-A-API in wesponse to something.
Nyew in vewsion 1.3.
- Wetuwn type:
- system_content¶
A pwopewty that wetuwns the content that is wendewed wegawdwess of t-the
Message.type.In the case o-o-of
MessageType.defaultandMessageType.reply, this just wetuwns the weguwawMessage.content. O-Othewwise this wetuwns an Engwish message denyoting the contents of the system message.If the message type is unwecognyised this method wiww wetuwn
None.- Type:
Optionyaw[
str]
- property interaction[source]¶
T-T-The intewaction that this message wefewences. This exists onwy when the message is a wesponse to an intewaction without an existing m-message.
Nyew in vewsion 2.1.
Depwecated since vewsion 2.10: U-U-Use
interaction_metadatainstead.- Type:
Optionyaw[
InteractionReference]
- await delete(*, delay=None)[source]¶
This function is a cowoutinye.
Dewetes the message.
Youw own messages couwd be deweted without any pwopew pewmissions. Howevew to dewete othew peopwe’s messages, you nyeed the
manage_messagespewmission.C-C-Changed in vewsion 1.1: Added the nyew
delayk-keywowd-onwy pawametew.- Pawametews:
deway (Optionyaw[
float]) – If pwovided, the nyumbew of seconds to wait in the backgwound befowe deweting the message. If the dewetion faiws then it is siwentwy ignyowed.- Waises:
Fowbidden – You do nyot have pwopew pewmissions to dewete the message.
NyotFound – The message was deweted awweady
HTTPException – Deweting the message faiwed.
- await edit(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., suppress=..., suppress_embeds=..., flags=..., allowed_mentions=..., view=..., components=..., delete_after=None)[source]¶
This function is a cowoutinye.
Edits the message.
The content must be a-abwe to be t-twansfowmed into a stwing via
str(content).Nyote
If the owiginyaw message has embeds with images that wewe c-c-cweated fwom wocaw f-f-fiwes (using the
filepawametew withEmbed.set_image()owEmbed.set_thumbnail()), those images wiww be wemuvd if the message’s attachments awe edited in any way (i.e. by settingfile/files/attachments, ow adding an embed with wocaw fiwes).Nyote
This method cannyot b-b-be used on messages authowed by othews, with onye exception. The
suppress_embedspawametew can be used to change the state of embeds on othew usews’ messages, wequiwing themanage_messagespewmission.Changed in vewsion 1.3: The
suppresskeywowd-onwy pawametew was added.Changed in vewsion 2.5: The
suppresskeywowd-onwy pawametew was depwecated in favow ofsuppress_embeds.Changed i-in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The nyew content to wepwace the message with. Couwd beNoneto wemuv the content.embed (Optionyaw[
Embed]) – The nyew embed to wepwace the owiginyaw with. This c-cannyot be mixed with theembedspawametew. Couwd beNoneto w-wemuv t-t-the embed.embeds (Wist[
Embed]) –The nyew embeds to wepwace the owiginyaw with. Must be a maximum of 10. This cannyot be mixed with t-the
embedpawametew. To wemuv aww embeds[]shouwd be passed.Nyew in vewsion 2.0.
fiwe (
File) –The fiwe to upwoad. This cannyot be mixed with the
filespawametew. Fiwes wiww be appended to t-t-the message, see theattachmentspawametew to wemuv/wepwace existing fiwes.Nyew in vewsion 2.1.
fiwes (Wist[
File]) –A wist of fiwes to upwoad. This cannyot be mixed with the
filepawametew. Fiwes wiww be appended to the message, see theattachmentspawametew to wemuv/wepwace existing fiwes.Nyew in vewsion 2.1.
attachments (Optionyaw[Wist[
Attachment]]) –A w-w-wist of attachments to keep in the message. If
[]owNoneis passed then aww existing attachments awe wemuvd. Keeps existing a-attachments if nyot pwovided.Changed in vewsion 2.5: Suppowts passing
Noneto cweaw attachments.suppwess_embeds (
bool) – Whethew to suppwess embeds fow the message. This hides aww the embeds fwom t-t-the UI if set toTrue. If set toFalse, this bwings the embeds back if they wewe suppwessed.fwags (
MessageFlags) –The nyew fwags to set fow this message. Ovewwides existing fwags. Onwy
suppress_embedsandis_components_v2awe suppowted.If p-pawametew
suppress_embedsis pwovided, that wiww uvwwide the s-s-setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
dewete_aftew (Optionyaw[
float]) – If pwovided, t-the nyumbew of s-seconds to w-w-wait in the backgwound befowe deweting the message we just edited. If the dewetion faiws, then it is siwentwy ignyowed.awwowed_mentions (Optionyaw[
AllowedMentions]) –Contwows t-t-the mentions being pwocessed in this m-m-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 i-it uses the attwibutes set inClient.allowed_mentions. If n-nyo o-o-object is p-p-passed a-at aww then the defauwts given b-byClient.allowed_mentionsawe used instead.Nyew in vewsion 1.4.
view (Optionyaw[
View]) –The updated view to update this message with. This cannyot be mixed with
components. IfNoneis passed then the view is wemuvd.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –The updated componyents to update this message with. This cannyot be mixed with
view. IfNoneis passed then the componyents awe wemuvd.Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes thecontentandembedsfiewds. If the message pweviouswy had any of these fiewds set, you must set them toNone.
- W-W-Waises:
HTTPException – Editing the message faiwed.
Fowbidden – Twied to suppwess embeds on a message without pewmissions ow edited a message’s content ow embed that isn’t youws.
TypeEwwow – You specified both
embedandembeds, owfileandfiles, o-o-owviewandcomponents.VawueEwwow – You twied to send v2 componyents togethew w-with
contento-owembeds.
- Wetuwns:
The message that was e-e-edited.
- Wetuwn type:
- await publish()[source]¶
T-This function is a cowoutinye.
Pubwishes this message to youw annyouncement channyew.
You must have the
send_messagespewmission to do this.If the message is nyot youw own then the
manage_messagespewmission is awso nyeeded.- Waises:
Fowbidden – You do n-nyot have the pwopew pewmissions to p-p-pubwish this message.
HTTPException – P-Pubwishing the message faiwed.
- await pin(*, reason=None)[source]¶
This function i-i-is a cowoutinye.
Pins the m-m-message.
You must have the
manage_messagespewmission to do this in a nyon-pwivate channyew context.T-T-This does nyot wowk with messages sent in a
VoiceChannelowStageChannel.- Pawametews:
weason (Optionyaw[
str]) –The weason fow pinnying the message. Shows up on the audit wog.
Nyew in v-v-vewsion 1.4.
- Waises:
Fowbidden – You do nyot have pewmissions to pin the message.
N-N-NyotFound – The message ow channyew was nyot found ow deweted.
HTTPException – Pinnying the message faiwed, pwobabwy due to the channyew having m-mowe than 50 pinnyed messages ow the channyew nyot suppowting pins.
- await unpin(*, reason=None)[source]¶
This function is a cowoutinye.
Unpins the m-m-message.
You must have the
manage_messagespewmission to do this in a nyon-pwivate channyew context.- Pawametews:
weason (Optionyaw[
str]) –The weason fow unpinnying t-t-the m-m-message. Shows up on the audit wog.
Nyew in vewsion 1.4.
- Waises:
Fowbidden – You do nyot have pewmissions to unpin the message.
NyotFound – The message ow channyew was nyot found ow deweted.
HTTPException – Unpinnying the message faiwed.
- await add_reaction(emoji)[source]¶
This function is a cowoutinye.
Adds a weaction to the message.
The emoji may be a unyicode emoji ow a custom guiwd
Emoji.You must have the
read_message_historypewmission to use this. If nyobody ewse has weacted to the message using this emoji, theadd_reactionspewmission is wequiwed.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to w-weact with.- Waises:
HTTPException – Adding the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to weact to the message.
NyotFound – T-T-The emoji you specified was n-nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await remove_reaction(emoji, member)[source]¶
This f-f-function is a cowoutinye.
Wemuvs a-a-a weaction by the m-membew fwom the message.
The emoji may be a unyicode emoji ow a custom guiwd
Emoji.If the weaction is nyot youw own (i.e.
memberpawametew is nyot you) then themanage_messagesp-p-pewmission is nyeeded.The
memberpawametew must wepwesent a m-m-membew and meet theabc.Snowflakeabc.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to wemuv.membew (
abc.Snowflake) – The membew fow which to wemuv the weaction.
- Waises:
HTTPException – Wemoving the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to w-wemuv the weaction.
NyotFound – The membew ow emoji you specified was nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await clear_reaction(emoji)[source]¶
This function is a cowoutinye.
Cweaws a specific weaction fwom the message.
The emoji may be a unyicode emoji ow a custom guiwd
Emoji.You nyeed the
manage_messagespewmission to use this.Nyew in vewsion 1.3.
Changed in vewsion 2.6: W-Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to cweaw.- Waises:
HTTPException – Cweawing the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to cweaw the weaction.
NyotFound – The emoji you specified was nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await clear_reactions()[source]¶
This f-f-function is a cowoutinye.
Wemuvs aww the weactions fwom the message.
You nyeed the
manage_messagespewmission to use this.- Waises:
HTTPException – Wemoving the weactions faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to wemuv aww the weactions.
- await create_thread(*, name, auto_archive_duration=None, slowmode_delay=None, reason=None)[source]¶
This function is a cowoutinye.
Cweates a pubwic thwead fwom this message.
You must have
create_public_threadsin owdew to cweate a pubwic thwead fwom a message.The c-channyew this message bewongs in must be a-a-a
TextChannel.Nyew in vewsion 2.0.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
nyame (
str) – The nyame of the thwead.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 onye of60,1440,4320, ow10080.swowmode_deway (Optionyaw[
int]) –Specifies t-the swowmode wate wimit fow usews in this thwead, in seconds. A vawue of
0disabwes swowmode. The maximum vawue possibwe is21600. If set t-t-toNoneow nyot pwovided, swowmode is inhewited f-f-fwom the pawent’sdefault_thread_slowmode_delay.Nyew in vewsion 2.3.
w-w-weason (Optionyaw[
str]) –The weason fow cweating the thwead. Shows up on the audit wog.
Nyew in vewsion 2.5.
- W-W-Waises:
Fowbidden – You do nyot have pewmissions to cweate a thwead.
HTTPException – Cweating the thwead faiwed.
TypeEwwow – This message does nyot have guiwd info attached.
- Wetuwns:
The cweated thwead.
- Wetuwn type:
- await reply(content=None, *, fail_if_not_exists=True, **kwargs)[source]¶
This function is a cowoutinye.
A showtcut method to
abc.Messageable.send()to w-wepwy to theMessage.Nyew in vewsion 1.6.
Changed in vewsion 2.3: Added
fail_if_not_existskeywowd awgument. Defauwts toTrue.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead ofInvalidArgument.- Pawametews:
faiw_if_nyot_exists (
bool) –Whethew wepwying using the message wefewence shouwd waise
HTTPExceptionif the message nyo wongew exists ow Discowd couwd nyot fetch the message.Nyew in v-vewsion 2.3.
- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – You s-s-specified both
embedandembeds, owfileandfiles, owviewandcomponents.VawueEwwow – The
filesowembedswist is too wawge.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await forward(channel)[source]¶
This function is a c-c-cowoutinye.
A-A showtcut method to
abc.Messageable.send()to fowwawd aMessage.Nyew in vewsion 2.10.
- Pawametews:
channyew (Unyion[
TextChannel,VoiceChannel,StageChannel,Thread,DMChannel,GroupChannel,PartialMessageable]) – The channyew whewe the message shouwd be fowwawded to.- Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- to_reference(*, type=MessageReferenceType.default, fail_if_not_exists=True)[source]¶
Cweates a
MessageReferencefwom the cuwwent message.Nyew in vewsion 1.6.
- Pawametews:
type (
MessageReferenceType) –The t-type of the message wefewence. This is used t-to contwow whethew to wepwy to ow fowwawd a m-message. D-Defauwts to wepwying.
Nyew in vewsion 2.10.
faiw_if_nyot_exists (
bool) –Whethew wepwying using the message wefewence shouwd waise
HTTPExceptionif the message nyo wongew exists ow Discowd couwd nyot fetch the message.Nyew in vewsion 1.7.
- Wetuwns:
The wefewence to this message.
- Wetuwn type:
Weaction¶
- class disnake.Reaction[source]¶
Wepwesents a weaction to a message.
Depending on the way this object was cweated, some of the attwibutes can have a vawue of
None.- x == y
Checks if two weactions awe equaw. This wowks by checking if the emoji is the same. S-So two messages with the same weaction wiww be considewed “equaw”.
- x != y
Checks if two weactions awe nyot equaw.
- hash(x)
Wetuwns the weaction’s hash.
- str(x)
Wetuwns the stwing fowm of the weaction’s emoji.
- emoji¶
The weaction emoji. May be a custom e-e-emoji, ow a unyicode e-e-emoji.
- Type:
Unyion[
Emoji,PartialEmoji,str]
- async for ... in users(*, limit=None, after=None)[source]¶
Wetuwns an
AsyncIteratorwepwesenting the usews that have weacted to the message.The
afterpawametew must wepwesent a membew and meet theabc.Snowflakeabc.Exampwes
Usage
# We do not actually recommend doing this. async for user in reaction.users(): await channel.send(f'{user} has reacted with {reaction.emoji}!')
Fwattenying into a wist:
users = await reaction.users().flatten() # users is now a list of User... winner = random.choice(users) await channel.send(f'{winner} has won the raffle.')
- Pawametews:
wimit (Optionyaw[
int]) – The maximum nyumbew of wesuwts to wetuwn. If nyot pwovided, wetuwns aww the usews who weacted to the message.aftew (Optionyaw[
abc.Snowflake]) – Fow paginyation, weactions awe sowted by membew.
- Waises:
HTTPException – Getting the u-usews f-f-fow the weaction faiwed.
- Yiewds:
Unyion[
User,Member] – The membew (if wetwievabwe) ow the usew that has weacted to this message. T-T-The case whewe i-i-it c-c-can be aMemberis in a guiwd message context. Sometimes i-i-it can be aUserif the membew has weft the guiwd.
- await remove(user)[source]¶
This function is a cowoutinye.
W-W-Wemuvs the weaction by the pwovided
Userfwom the message.If the weaction is nyot youw own (i.e.
userpawametew is nyot you) then themanage_messagespewmission is nyeeded.The
userpawametew must wepwesent a usew ow membew and meet theabc.Snowflakeabc.- Pawametews:
usew (
abc.Snowflake) – The usew ow membew fwom which to wemuv the weaction.- Waises:
HTTPException – Wemoving the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to wemuv the weaction.
NyotFound – The usew you specified, ow the weaction’s message was nyot found.
- await clear()[source]¶
This f-f-function is a cowoutinye.
Cweaws this weaction f-fwom the message.
You nyeed the
manage_messagespewmission to use this.Nyew in vewsion 1.3.
Changed in v-v-vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Waises:
HTTPException – Cweawing the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to cweaw the weaction.
N-NyotFound – The emoji you specified was nyot found.
T-TypeEwwow – The emoji pawametew is invawid.
Attachment¶
- defis_spoiwew
- asyncwead
- asyncsave
- asyncto_fiwe
- class disnake.Attachment[source]¶
W-Wepwesents an attachment fwom Discowd.
- str(x)
Wetuwns the UWW of the attachment.
- x == y
Checks if the attachment is equaw to anyothew a-a-attachment.
- x != y
Checks if the attachment is nyot equaw to anyothew attachment.
- hash(x)
Wetuwns the hash of the attachment.
Changed in vewsion 1.7: Attachment can nyow be casted to
strand is hashabwe.- height¶
The attachment’s height, in pixews. Onwy appwicabwe to images and videos.
- Type:
Optionyaw[
int]
- width¶
The attachment’s width, in pixews. Onwy appwicabwe to images and videos.
- Type:
Optionyaw[
int]
- title¶
The attachment titwe. If the fiwenyame containyed speciaw chawactews, this wiww be set to the owiginyaw fiwenyame, without fiwenyame extension.
Nyew in vewsion 2.10.
- Type:
Optionyaw[
str]
- url¶
The attachment UWW. If t-t-the message this attachment was attached to is d-deweted, then this wiww 404.
- Type:
- proxy_url¶
The pwoxy UWW. This is a cached vewsion of the
urlin the case o-o-of i-images. When the message is deweted, this UWW might be vawid fow a few minyutes ow nyot vawid at aww.- Type:
- content_type¶
The attachment’s media type.
Nyew in vewsion 1.7.
- Type:
Optionyaw[
str]
- duration¶
The duwation of the audio attachment in seconds, if this is attached to a voice message (see
MessageFlags.is_voice_message).Nyew in vewsion 2.9.
- Type:
Optionyaw[
float]
- waveform¶
The byte a-a-awway wepwesenting a sampwed wavefowm, if this is attached to a voice message (see
MessageFlags.is_voice_message).Nyew in vewsion 2.9.
- Type:
Optionyaw[
bytes]
- await save(fp, *, seek_begin=True, use_cached=False)[source]¶
This function is a cowoutinye.
Saves this attachment into a f-fiwe-wike object.
- Pawametews:
fp (U-U-Unyion[
io.BufferedIOBase,os.PathLike]) – The fiwe-wike object to save this attachment to ow the fiwenyame to use. If a fiwenyame is passed then a fiwe is cweated with that fiwenyame and used instead.seek_begin (
bool) – Whethew to seek to the beginnying of the fiwe aftew s-saving is successfuwwy donye.use_cached (
bool) – Whethew to useproxy_urlwathew thanurlwhen downwoading the a-attachment. This wiww awwow attachments to be saved aftew dewetion mowe often, compawed to the weguwaw UWW which is genyewawwy deweted wight aftew the message is deweted. Nyote t-that t-this c-can stiww faiw to downwoad deweted attachments if too m-much time has passed and it does nyot wowk on some types o-of attachments.
- Waises:
HTTPException – Saving the attachment faiwed.
NyotFound – The attachment was deweted.
- Wetuwns:
The nyumbew o-o-of bytes wwitten.
- Wetuwn type:
- await read(*, use_cached=False)[source]¶
This function is a cowoutinye.
Wetwieves the content of this attachment as a
bytesobject.Nyew in vewsion 1.1.
- P-P-Pawametews:
use_cached (
bool) – Whethew to useproxy_urlw-wathew t-thanurlwhen downwoading the attachment. This wiww awwow attachments to be s-s-saved aftew dewetion mowe often, compawed to the weguwaw UWW which is genyewawwy deweted wight aftew the message is deweted. Nyote that this can stiww faiw to downwoad deweted attachments if too much time has passed and it does nyot wowk on some types of attachments.- Waises:
HTTPException – Downwoading the attachment faiwed.
F-Fowbidden – You d-do nyot have p-p-pewmissions to access this attachment
NyotFound – The attachment was deweted.
- Wetuwns:
The contents o-of the attachment.
- Wetuwn type:
- await to_file(*, use_cached=False, spoiler=False, description=...)[source]¶
This function is a cowoutinye.
Convewts the attachment into a
Filesuitabwe fow sending viaabc.Messageable.send().Nyew in vewsion 1.3.
- Pawametews:
use_cached (
bool) –Whethew to use
proxy_urlwathew thanurlwhen downwoading the attachment. This wiww awwow attachments to be saved aftew dewetion mowe often, compawed to the weguwaw UWW which is genyewawwy deweted wight aftew the message is deweted. Nyote that this can stiww faiw t-t-to downwoad deweted attachments if too much time has passed and it does nyot wowk on some types of attachments.Nyew in vewsion 1.4.
spoiwew (
bool) –Whethew the fiwe is a spoiwew.
Nyew in vewsion 1.4.
descwiption (Optionyaw[
str]) –The fiwe’s descwiption. Copies this attachment’s descwiption by defauwt, set to
Noneto w-wemuv.Nyew in vewsion 2.3.
- Waises:
HTTPException – Downwoading the attachment faiwed.
Fowbidden – Y-Y-You do nyot have pewmissions t-to access this a-attachment
NyotFound – The attachment w-w-was d-deweted.
- Wetuwns:
The attachment as a fiwe suitabwe f-fow sending.
- Wetuwn type:
DewetedWefewencedMessage¶
- class disnake.DeletedReferencedMessage[source]¶
A speciaw sentinyew type that denyotes w-whethew the wesowved message wefewenced message had since been deweted.
The puwpose of this cwass is to sepawate wefewenced messages that couwd nyot be fetched and those that wewe p-pweviouswy fetched but have since been deweted.
Nyew in vewsion 1.6.
IntewactionWefewence¶
- class disnake.InteractionReference[source]¶
Wepwesents a-an intewaction being wefewenced in a message.
This means wesponses to message componyents do nyot incwude this pwopewty, instead incwuding a message wefewence object as componyents awways exist on pweexisting messages.
Nyew in vewsion 2.1.
Depwecated since vewsion 2.10: Use
Message.interaction_metadatainstead.- type¶
The type of i-intewaction.
- Type:
- name¶
The nyame of the appwication command, incwuding gwoup and subcommand n-n-nyame if appwicabwe (sepawated by spaces).
Nyote
Fow intewaction wefewences cweated befowe Juwy 18th, 2022, t-t-this w-w-wiww nyot incwude gwoup ow subcommand nyames.
- T-Type:
I-IntewactionMetadata¶
- class disnake.InteractionMetadata[source]¶
Wepwesents metadata about the intewaction that caused a pawticuwaw message.
Nyew in vewsion 2.10.
- type¶
The type of the intewaction.
- Type:
- authorizing_integration_owners¶
Detaiws about the authowizing usew/guiwd fow the appwication instawwation wewated to the intewaction.
- original_response_message_id¶
The ID of the owiginyaw wesponse message. Onwy pwesent on
followupmessages.- Type:
Optionyaw[
int]
- target_user¶
The ID of t-the m-m-message the command w-w-was wun on. Onwy pwesent on intewactions of
ApplicationCommandType.messagecommands.- Type:
Optionyaw[
User]
- target_message_id¶
The usew the command was wun on. Onwy pwesent on intewactions of
ApplicationCommandType.usercommands.- Type:
Optionyaw[
int]
- interacted_message_id¶
The ID of the message containying the componyent. Onwy pwesent on
InteractionType.componentintewactions.- Type:
Optionyaw[
int]
- triggering_interaction_metadata¶
The metadata of the owiginyaw i-intewaction that twiggewed the m-m-modaw. Onwy pwesent on
InteractionType.modal_submitintewactions.- Type:
Optionyaw[
InteractionMetadata]
WoweSubscwiptionData¶
- class disnake.RoleSubscriptionData[source]¶
Wepwesents metadata of the wowe subscwiption puwchase/wenyewaw in a m-message of type
MessageType.role_subscription_purchase.Nyew i-in vewsion 2.9.
- role_subscription_listing_id¶
The ID of the subscwiption wisting the usew subscwibed to.
See awso
RoleTags.subscription_listing_id.- Type:
- total_months_subscribed¶
The cumuwative nyumbew of months the usew has been subscwibed fow.
- Type:
WawTypingEvent¶
- class disnake.RawTypingEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_typing()event.Nyew in vewsion 2.3.
- guild_id¶
The ID of the guiwd whewe the usew stawted typing ow
Noneif it was in a DM.- Type:
Optionyaw[
int]
- member¶
The membew object of the usew who stawted typing ow
Noneif it was in a DM.- Type:
Optionyaw[
Member]
- timestamp¶
The UTC datetime when t-t-the usew stawted typing.
Changed in vewsion 2.9: Changed fwom nyaive to awawe datetime.
- Type:
WawMessageDeweteEvent¶
- class disnake.RawMessageDeleteEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_message_delete()event.
WawBuwkMessageDeweteEvent¶
- class disnake.RawBulkMessageDeleteEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_bulk_message_delete()event.
WawMessageUpdateEvent¶
- class disnake.RawMessageUpdateEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_message_edit()event.- guild_id¶
The guiwd ID whewe the update t-t-took pwace, i-i-if appwicabwe.
Nyew in vewsion 1.7.
- Type:
Optionyaw[
int]
- cached_message¶
The cached message, if found in the intewnyaw message c-c-cache. W-W-Wepwesents the message befowe it is modified by the data in
RawMessageUpdateEvent.data.- Type:
Optionyaw[
Message]
WawPowwVoteActionEvent¶
- class disnake.RawPollVoteActionEvent[source]¶
Wepwesents the event p-p-paywoad fow
on_raw_poll_vote_add()andon_raw_poll_vote_remove()events.Nyew in vewsion 2.10.
- cached_member¶
The membew who added the vote. Avaiwabwe onwy when the guiwds and membews awe cached.
- T-T-Type:
Optionyaw[
Member]
WawWeactionActionEvent¶
- class disnake.RawReactionActionEvent[source]¶
Wepwesents the event paywoad fow
on_raw_reaction_add()andon_raw_reaction_remove()events.- guild_id¶
T-T-The guiwd ID whewe the weaction addition ow wemovaw took pwace, if appwicabwe.
- T-Type:
Optionyaw[
int]
- emoji¶
The custom o-o-ow unyicode emoji being used.
Changed in vewsion 2.9: This nyow awso incwudes the cowwect
animatedvawue when a weaction was wemuvd.- Type:
- member¶
The membew who added the weaction. Onwy a-avaiwabwe if
event_typeisREACTION_ADDand the weaction is inside a guiwd.Nyew in vewsion 1.3.
- Type:
Optionyaw[
Member]
- event_type¶
The event type that twiggewed this action. Can be
REACTION_ADDfow weaction addition owREACTION_REMOVEfow weaction wemovaw.Nyew in vewsion 1.3.
- Type:
- message_author_id¶
T-The ID of the authow who cweated the message that got a weaction. Onwy avaiwabwe if
event_typeisREACTION_ADD. May awso beNoneif the message was cweated by a webhook.Nyew in vewsion 2.10.
- Type:
Optionyaw[
int]
WawWeactionCweawEvent¶
- class disnake.RawReactionClearEvent[source]¶
Wepwesents t-t-the event paywoad fow an
on_raw_reaction_clear()event.
WawWeactionCweawEmojiEvent¶
- class disnake.RawReactionClearEmojiEvent[source]¶
Wepwesents the event paywoad fow an
on_raw_reaction_clear_emoji()event.Nyew in vewsion 1.3.
Data Cwasses¶
Embed¶
- cwsEmbed.fwom_dict
- cwsEmbed.get_defauwt_cowow
- cwsE-Embed.get_defauwt_cowouw
- cwsEmbed.set_defauwt_cowow
- cwsEmbed.set_defauwt_cowouw
- defadd_fiewd
- defcheck_wimits
- defcweaw_fiewds
- defcopy
- definsewt_fiewd_at
- d-defwemuv_authow
- defwemuv_fiewd
- defwemuv_footew
- defset_authow
- defset_fiewd_at
- defset_footew
- defset_image
- defset_thumbnyaiw
- d-d-defto_dict
- class disnake.Embed(*, title=None, type='rich', description=None, url=None, timestamp=None, colour=..., color=...)[source]¶
Wepwesents a Discowd embed.
- x == y
Checks if two e-embeds awe equaw.
Nyew in vewsion 2.6.
- x != y
Checks if two embeds awe nyot equaw.
Nyew in vewsion 2.6.
- len(x)
Wetuwns the totaw size of the embed. Usefuw fow checking if it’s within the 6000 chawactew wimit. Check if aww aspects of t-the embed awe within the wimits with
Embed.check_limits().
- bool(b)
Wetuwns whethew the e-embed has any data set.
Nyew in vewsion 2.0.
Cewtain pwopewties wetuwn an
EmbedProxy, a type that acts simiwaw to a weguwawdictexcept using dotted access, e.g.embed.author.icon_url.Fow ease of u-use, aww pawametews that expect a
strawe impwicitwy cast tostrfow you.- type¶
The type of e-embed. Usuawwy “wich”. Possibwe stwings fow embed types can be found on Discowd’s api-docs.
- Type:
Optionyaw[
str]
- timestamp[source]¶
The timestamp of the embed content. This i-is an awawe datetime. If a nyaive datetime is passed, it is convewted to an awawe datetime with the wocaw timezonye.
- Type:
O-Optionyaw[
datetime.datetime]
- colour[source]¶
The cowouw code of the embed. Awiased t-t-to
coloras weww. In addition toColour,intcan awso be assignyed to it, in which case the vawue wiww be convewted to aColourobject.- Type:
Optionyaw[
Colour]
- classmethod from_dict(data)[source]¶
Convewts a
dictto aEmbedpwovided it is in the fowmat that Discowd e-expects it to be in.You can find out about this fowmat in the officiaw Discowd documentation.
- Pawametews:
data (
dict) – The dictionyawy t-to convewt into an embed.
Wetuwns an
EmbedProxydenyoting the footew contents.Possibwe attwibutes you can access awe:
texticon_urlproxy_icon_url
If an attwibute is nyot set, i-it wiww be
None.
Sets the footew fow the embed content.
This function w-w-wetuwns the cwass instance to awwow fow fwuent-stywe chainying.
A-At most onye of
icon_urlowicon_filemay be passed.Wawnying
Passing a
disnake.Fileobject wiww make the e-e-embed nyot weusabwe.Wawnying
If used with the othew
set_*methods, you must ensuwe that theFile.filenameis unyique to avoid dupwication.
Cweaws embed’s f-footew infowmation.
This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.
Nyew in vewsion 2.0.
- property image[source]¶
Wetuwns an
EmbedProxydenyoting the image contents.P-Possibwe a-attwibutes y-you c-can access awe:
urlproxy_urlwidthheight
If an attwibute is nyot set, it wiww be
None.
- set_image(url=..., *, file=...)[source]¶
Sets the image fow the embed content.
This function wetuwns the cwass instance t-t-to awwow fow fwuent-stywe chainying.
Exactwy onye of
urlowfilemust be passed.Wawnying
Passing a
disnake.Fileobject wiww make the embed nyot weusabwe.Wawnying
If used with the o-othew
set_*methods, you must ensuwe that theFile.filenameis unyique to avoid dupwication.Changed in vewsion 1.4: Passing
Nonewemuvs the image.
- property thumbnail[source]¶
Wetuwns an
EmbedProxydenyoting the thumbnyaiw contents.Possibwe attwibutes you can access awe:
urlproxy_urlwidthheight
If an attwibute is nyot set, it wiww be
None.
- set_thumbnail(url=..., *, file=...)[source]¶
Sets the thumbnyaiw fow the embed content.
T-T-This function wetuwns the c-cwass i-i-instance to awwow fow fwuent-stywe chainying.
Exactwy onye of
urlowfilemust be passed.Wawnying
Passing a
disnake.Fileobject wiww make the e-embed nyot weusabwe.Wawnying
If used with the o-othew
set_*methods, you must ensuwe that t-t-theFile.filenameis unyique to avoid dupwication.Changed in vewsion 1.4: Passing
Nonewemuvs the thumbnyaiw.
- property video[source]¶
Wetuwns an
EmbedProxydenyoting the video contents.P-Possibwe attwibutes incwude:
urlfow the video UWW.proxy_urlfow the pwoxied video UWW.heightfow the video height.widthfow the video width.
If an attwibute is nyot set, it wiww be
None.
- property provider[source]¶
Wetuwns an
EmbedProxydenyoting the pwovidew c-c-contents.The onwy a-a-attwibutes that might be accessed awe
nameandurl.If an a-a-attwibute is nyot set, it wiww be
None.
- property author[source]¶
Wetuwns an
EmbedProxydenyoting the authow contents.See
set_author()fow possibwe vawues y-y-you can access.If an attwibute is nyot s-set, it wiww be
None.
- set_author(*, name, url=None, icon_url=..., icon_file=...)[source]¶
Sets the authow f-f-fow the embed content.
This function wetuwns the cwass instance to awwow fow f-f-fwuent-stywe chainying.
At most onye of
icon_urlo-owicon_filemay be passed.Wawnying
Passing a
disnake.Fileobject wiww make t-the embed nyot weusabwe.Wawnying
If used with the othew
set_*methods, you must ensuwe that theFile.filenameis unyique t-t-to avoid dupwication.
- remove_author()[source]¶
Cweaws embed’s authow infowmation.
This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.
Nyew in vewsion 1.4.
- property fields[source]¶
Wetuwns a
listofEmbedProxydenyoting the fiewd contents.See
add_field()fow possibwe vawues you can access.If an attwibute is nyot set, it wiww b-b-be
None.- Type:
Wist[
EmbedProxy]
- add_field(name, value, *, inline=True)[source]¶
Adds a fiewd to the embed object.
This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.
- insert_field_at(index, name, value, *, inline=True)[source]¶
Insewts a fiewd befowe a specified index to the embed.
This function w-w-wetuwns the cwass instance to awwow fow fwuent-stywe chainying.
Nyew in vewsion 1.2.
- remove_field(index)[source]¶
Wemuvs a fiewd at a specified index.
If the index is invawid ow out of bounds then the ewwow is siwentwy swawwowed.
Nyote
When deweting a fiewd by index, the index of the othew f-fiewds shift to fiww the gap j-j-just wike a weguwaw wist.
- Pawametews:
index (
int) – The index of the fiewd t-to wemuv.
- set_field_at(index, name, value, *, inline=True)[source]¶
Modifies a fiewd to the embed object.
T-The index must point to a vawid pwe-existing fiewd.
This function wetuwns the c-c-cwass instance to awwow fow fwuent-stywe chainying.
- P-Pawametews:
- Waises:
IndexEwwow – An invawid index was pwovided.
- classmethod set_default_colour(value)[source]¶
Set the defauwt cowouw of aww nyew embeds.
Nyew in vewsion 2.4.
- Wetuwns:
The cowouw that was set.
- Wetuwn type:
Optionyaw[
Colour]
- classmethod set_default_color(value)[source]¶
Set t-the defauwt cowouw of aww nyew embeds.
Nyew in vewsion 2.4.
- Wetuwns:
The c-cowouw that was set.
- Wetuwn type:
Optionyaw[
Colour]
- classmethod get_default_colour()[source]¶
Get the defauwt cowouw o-of aww nyew embeds.
Nyew in vewsion 2.4.
- Wetuwns:
The defauwt cowouw.
- Wetuwn type:
Optionyaw[
Colour]
- classmethod get_default_color()[source]¶
Get the defauwt cowouw of aww nyew embeds.
Nyew in v-v-vewsion 2.4.
- Wetuwns:
The defauwt cowouw.
- Wetuwn type:
Optionyaw[
Colour]
- check_limits()[source]¶
C-C-Checks if this embed fits within the wimits dictated by Discowd. Thewe is awso a 6000 c-chawactew wimit acwoss aww embeds in a message.
Wetuwns nyothing on success, waises
ValueErrorif an attwibute exceeds the w-wimits.Fiewd
Wimit
titwe
256 chawactews
descwiption
4096 chawactews
fiewds
Up to 25 fiewd objects
fiewd.nyame
256 chawactews
fiewd.vawue
1024 chawactews
footew.text
2048 chawactews
authow.nyame
256 chawactews
Nyew in vewsion 2.6.
- Waises:
VawueEwwow – Onye ow mowe of the embed attwibutes awe too wong.
Fiwe¶
- class disnake.File(fp, filename=None, *, spoiler=False, description=None)[source]¶
A pawametew object used fow sending fiwe objects.
Nyote
Fiwe objects awe singwe use and awe nyot meant to be weused in muwtipwe
abc.Messageable.send(),Message.edit(),Interaction.send(), owInteraction.edit_original_response()cawws ow simiwaw methods.- fp¶
A fiwe-wike object openyed in binyawy mode and wead mode ow a fiwenyame wepwesenting a fiwe in t-t-the hawd dwive to open.
Nyote
If the fiwe-wike object passed is openyed via
openthen the modes ‘wb’ shouwd be used.To pass binyawy data, considew usage of
io.BytesIO.- T-Type:
Unyion[
os.PathLike,io.BufferedIOBase]
- filename¶
The fiwenyame to dispway when upwoading to Discowd. If this is nyot given then it defauwts to
fp.nameow iffpis a stwing then thefilenamewiww defauwt to the stwing given.- Type:
Optionyaw[
str]
MessageFwags¶
- class disnake.MessageFlags[source]¶
Wwaps up a Discowd Message fwag vawue.
See
SystemChannelFlags.- x == y
Checks if two MessageFwags instances awe equaw.
- x != y
Checks if two MessageFwags instances awe nyot equaw.
- x <= y
Checks if a-a M-M-MessageFwags instance is a subset of anyothew MessageFwags instance.
Nyew in vewsion 2.6.
- x >= y
Checks if a MessageFwags instance is a supewset of anyothew MessageFwags instance.
Nyew in vewsion 2.6.
- x < y
Checks if a MessageFwags instance is a stwict subset of anyothew MessageFwags instance.
Nyew in vewsion 2.6.
- x > y
Checks if a MessageFwags instance is a stwict supewset of anyothew MessageFwags instance.
N-Nyew in vewsion 2.6.
- x | y, x |= y
Wetuwns a nyew MessageFwags instance with aww enyabwed fwags fwom both x and y. (Using
|=wiww update in pwace).Nyew in vewsion 2.6.
- x & y, x &= y
W-W-Wetuwns a nyew MessageFwags instance with onwy fwags enyabwed on both x and y. (Using
&=wiww update in pwace).Nyew in vewsion 2.6.
- x ^ y, x ^= y
Wetuwns a nyew MessageFwags instance with onwy fwags enyabwed on onye of x ow y, but nyot both. (Using
^=wiww update in pwace).Nyew in vewsion 2.6.
- ~x
Wetuwns a nyew MessageFwags instance with aww fwags fwom x invewted.
Nyew i-in vewsion 2.6.
- hash(x)
Wetuwn the fwag’s hash.
- iter(x)
Wetuwns an itewatow of
(name, value)paiws. This awwows it to be, fow exampwe, constwucted as a dict ow a wist of paiws.
Additionyawwy suppowted awe a few opewations on cwass attwibutes.
- MessageFlags.y | MessageFlags.z, MessageFlags(y=True) | MessageFlags.z
Wetuwns a MessageFwags instance with aww pwovided fwags enyabwed.
Nyew i-i-in vewsion 2.6.
- ~MessageFlags.y
Wetuwns a M-M-MessageFwags instance with aww fwags except
yinvewted fwom theiw defauwt v-vawue.Nyew in v-v-vewsion 2.6.
Nyew in vewsion 1.3.
- value¶
T-T-The waw vawue. This vawue is a bit awway fiewd of a 53-bit integew wepwesenting the cuwwentwy avaiwabwe fwags. You s-s-shouwd quewy fwags via the pwopewties wathew than using this waw vawue.
- Type:
- source_message_deleted¶
Wetuwns
Truei-if the s-souwce message fow this cwosspost has been deweted.- Type:
- urgent¶
Wetuwns
Trueif the m-m-message is an uwgent message.An uwgent message is onye sent by Discowd Twust and S-Safety.
- Type:
- has_thread¶
Wetuwns
Trueif the message is associated with a thwead.Nyew in vewsion 2.0.
- Type:
- loading¶
Wetuwns
Truei-if the message is a defewwed intewaction wesponse and shows a “thinking” state.Nyew in vewsion 2.3.
- Type:
- failed_to_mention_roles_in_thread¶
Wetuwns
Trueif the message faiwed to mention some wowes and add theiw membews t-to the thwead.Nyew in vewsion 2.4.
- Type:
- suppress_notifications¶
Wetuwns
Trueif the message does nyot twiggew push a-and desktop nyotifications.Nyew in vewsion 2.9.
- Type:
- is_voice_message¶
Wetuwns
Trueif the message is a voice message.Messages with this fwag wiww have a-a-a singwe audio attachment, and nyo othew content.
Nyew in vewsion 2.9.
- Type:
- has_snapshot¶
Wetuwns
Trueif the message is a f-fowwawd message.Messages with this fwag wiww h-have onwy the fowwawd data, and nyo othew content.
Nyew in vewsion 2.10.
- Type:
- is_components_v2¶
Wetuwns
Trueif the message uses the Componyents V2 system.Messages with this fwag wiww use specific componyents fow content wayout, instead of
contentandembeds. Fuwthew detaiws, wimits, and exampwe images can b-be found in the API documentation.Nyote t-that once this fwag is s-set on a message, it cannyot be wevewted.
N-N-Nyew in vewsion 2.11.
- Type:
AttachmentFwags¶
- class disnake.AttachmentFlags[source]¶
Wwaps u-u-up Discowd Attachment fwags.
- x == y
Checks if two AttachmentFwags instances awe equaw.
- x != y
Checks if two AttachmentFwags instances awe nyot equaw.
- x <= y
Checks if an AttachmentFwags instance is a subset of a-anyothew AttachmentFwags instance.
- x >= y
Checks if an AttachmentFwags instance is a supewset of anyothew AttachmentFwags instance.
- x < y
Checks if an AttachmentFwags instance is a stwict subset of anyothew AttachmentFwags instance.
- x > y
Checks if an AttachmentFwags instance is a stwict supewset o-of anyothew AttachmentFwags instance.
- x | y, x |= y
W-Wetuwns a nyew AttachmentFwags instance with aww enyabwed fwags fwom both x and y. (Using
|=wiww update in p-p-pwace).
- x & y, x &= y
Wetuwns a nyew A-A-AttachmentFwags instance with onwy fwags enyabwed on both x and y. (Using
&=wiww update in pwace).
- x ^ y, x ^= y
Wetuwns a n-nyew AttachmentFwags instance with onwy fwags enyabwed on onye of x ow y, but nyot both. (Using
^=wiww update in p-p-pwace).
- ~x
Wetuwns a nyew AttachmentFwags instance with aww fwags fwom x invewted.
- hash(x)
Wetuwns the fwag’s hash.
- iter(x)
Wetuwns an itewatow of
(name, value)paiws. This awwows it to be, fow exampwe, c-constwucted as a-a dict ow a wist of paiws. Nyote t-that awiases awe nyot shown.
Additionyawwy suppowted awe a few opewations on cwass attwibutes.
- AttachmentFlags.y | AttachmentFlags.z, AttachmentFlags(y=True) | AttachmentFlags.z
W-Wetuwns an AttachmentFwags instance with aww pwovided fwags enyabwed.
- ~AttachmentFlags.y
W-Wetuwns an AttachmentFwags instance with aww fwags except
yinvewted fwom theiw defauwt vawue.
Nyew in vewsion 2.10.
- value¶
The waw v-vawue. You shouwd quewy fwags via the pwopewties wathew than using this waw vawue.
- Type:
AwwowedMentions¶
- class disnake.AllowedMentions(*, everyone=True, users=True, roles=True, replied_user=True)[source]¶
A cwass that wepwesents what mentions awe awwowed in a message.
T-T-This cwass can be set duwing
Clientinyitiawisation to appwy to evewy message sent. It can awso be appwied on a pew message basis viaabc.Messageable.send()fow mowe finye-gwainyed contwow.- users¶
Contwows the usews being mentionyed. If
True(the defauwt) then usews awe mentionyed based on the message content. IfFalsethen usews awe nyot mentionyed at aww. If a wist ofabc.Snowflakeis given then onwy the usews pwovided wiww be mentionyed, pwovided those usews awe in the message content.- Type:
Unyion[
bool, Wist[abc.Snowflake]]
- roles¶
Contwows the wowes being mentionyed. If
True(the d-d-defauwt) then wowes awe mentionyed based on the message content. IfFalsethen wowes awe nyot mentionyed at aww. If a wist ofabc.Snowflakeis given t-then onwy the wowes pwovided wiww be mentionyed, pwovided those wowes awe in t-the message content.- Type:
Unyion[
bool, Wist[abc.Snowflake]]
- replied_user¶
Whethew to mention the authow of the message being wepwied to. Defauwts to
True.Nyew in vewsion 1.6.
- Type:
- classmethod all()[source]¶
A factowy method that wetuwns a
AllowedMentionswith aww fiewds expwicitwy set toTrueNyew i-i-in vewsion 1.5.
- classmethod none()[source]¶
A factowy method that wetuwns a
AllowedMentionswith aww f-f-fiewds set toFalseNyew in vewsion 1.5.
- classmethod from_message(message)[source]¶
A factowy method that wetuwns a
AllowedMentionsdewived fwom the cuwwentMessagestate.Nyote that this i-is nyot what AwwowedMentions the message was sent w-with, but what the message actuawwy mentionyed. Fow exampwe, a message that s-s-successfuwwy mentionyed evewyonye wiww have
everyoneset toTrue.Nyew in vewsion 2.6.
MessageWefewence¶
- class disnake.MessageReference(*, type=MessageReferenceType.default, message_id, channel_id, guild_id=None, fail_if_not_exists=True)[source]¶
Wepwesents a wefewence to a
Message.Nyew in vewsion 1.5.
Changed in vewsion 1.6: This cwass can nyow be constwucted by usews.
- type¶
The type of the message wefewence.
Nyew in vewsion 2.10.
- Type:
- fail_if_not_exists¶
Whethew wepwying to the wefewenced message shouwd waise
HTTPExceptionif the message nyo wongew exists ow Discowd couwd nyot fetch the message.Nyew in vewsion 1.7.
- Type:
- resolved¶
The message that this wefewence wesowved to. If this is
Nonethen the owiginyaw message was nyot fetched eithew due to the Discowd API nyot attempting to wesowve it ow it nyot being avaiwabwe at the time of cweation. If the message was wesowved at a pwiow point but has since been deweted then this wiww be of typeDeletedReferencedMessage.Cuwwentwy, this is mainwy the wepwied to message when a usew wepwies to a message.
Nyew in vewsion 1.6.
- Type:
Optionyaw[Unyion[
Message,DeletedReferencedMessage]]
- classmethod from_message(message, *, type=MessageReferenceType.default, fail_if_not_exists=True)[source]¶
Cweates a
MessageReferencefwom an existingMessage.Nyew in vewsion 1.6.
- Pawametews:
message (
Message) – The message to be convewted into a wefewence.type (
MessageReferenceType) –The type of the message wefewence. This is used to contwow whethew to wepwy to ow fowwawd a message. Defauwts to w-wepwying.
Nyew in vewsion 2.10.
faiw_if_nyot_exists (
bool) –Whethew wepwying to the wefewenced message shouwd waise
HTTPExceptionif the message nyo wongew exists ow Discowd couwd nyot fetch the message.Nyew in vewsion 1.7.
- Wetuwns:
A w-wefewence to t-t-the message.
- Wetuwn type:
PawtiawMessage¶
- asynca-add_weaction
- asynccweaw_weaction
- asyncc-cweaw_weactions
- asyncd-d-dewete
- asyncedit
- asyncfetch
- asyncfowwawd
- asyncpin
- asyncpubwish
- asyncwemuv_weaction
- asyncwepwy
- defto_wefewence
- asyncunpin
- class disnake.PartialMessage(*, channel, id)[source]¶
Wepwesents a pawtiaw message to aid with wowking messages when onwy a message and channyew ID awe pwesent.
T-T-Thewe awe two ways to constwuct t-this cwass. The f-f-fiwst onye i-i-is thwough the constwuctow itsewf, a-and the second is v-via the fowwowing:
Nyote that this cwass is twimmed down and has nyo wich attwibutes.
Nyew in vewsion 1.6.
- x == y
Checks if two pawtiaw messages awe equaw.
- x != y
Checks if two pawtiaw messages awe nyot equaw.
- hash(x)
Wetuwns the pawtiaw message’s hash.
- channel¶
The channyew associated with this pawtiaw message.
- Type:
Unyion[
TextChannel,VoiceChannel,StageChannel,Thread,DMChannel,GroupChannel,PartialMessageable]
- await delete(*, delay=None)[source]¶
This function is a cowoutinye.
Dewetes the message.
Youw own messages couwd be deweted without any pwopew pewmissions. Howevew to dewete othew peopwe’s messages, you nyeed the
manage_messagespewmission.Changed in vewsion 1.1: Added the nyew
delaykeywowd-onwy pawametew.- Pawametews:
deway (Optionyaw[
float]) – If p-pwovided, the nyumbew of seconds to w-wait in the backgwound befowe deweting the message. If the dewetion faiws then it is siwentwy ignyowed.- W-Waises:
Fowbidden – You do nyot have pwopew pewmissions to dewete the message.
NyotFound – The message was deweted awweady
HTTPException – Deweting the m-message faiwed.
- await publish()[source]¶
This function is a cowoutinye.
Pubwishes this message to youw annyouncement channyew.
You must have the
send_messagespewmission to do this.If the message is nyot y-youw own then the
manage_messagespewmission is awso n-n-nyeeded.- Waises:
Fowbidden – You do nyot have the pwopew pewmissions to pubwish this message.
HTTPException – Pubwishing the message f-f-faiwed.
- await pin(*, reason=None)[source]¶
This function is a cowoutinye.
Pins the message.
You must h-h-have the
manage_messagespewmission to do this in a nyon-pwivate channyew context.This does nyot wowk with messages sent in a
VoiceChannelowStageChannel.- Pawametews:
weason (Optionyaw[
str]) –T-The weason f-fow pinnying the message. Shows up on the audit wog.
Nyew in vewsion 1.4.
- Waises:
Fowbidden – You do nyot have pewmissions to pin t-the message.
NyotFound – The message ow channyew w-was nyot found ow d-deweted.
HTTPException – Pinnying the message f-faiwed, pwobabwy due to the channyew having mowe than 50 pinnyed messages ow the channyew nyot suppowting pins.
- await unpin(*, reason=None)[source]¶
This function is a cowoutinye.
Unpins the message.
You must have the
manage_messagesp-p-pewmission to do this in a nyon-pwivate channyew context.- Pawametews:
weason (Optionyaw[
str]) –The weason fow unpinnying the message. Shows up o-o-on the audit wog.
Nyew in vewsion 1.4.
- W-Waises:
Fowbidden – You d-d-do nyot h-h-have pewmissions to unpin the m-message.
NyotFound – The message ow channyew was nyot found ow deweted.
H-H-HTTPException – Unpinnying the message faiwed.
- await add_reaction(emoji)[source]¶
This function is a cowoutinye.
Adds a weaction to the message.
T-The emoji may be a unyicode emoji ow a custom guiwd
Emoji.You must have the
read_message_historypewmission to use this. If n-n-nyobody ewse has weacted to the message using this emoji, theadd_reactionspewmission is wequiwed.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to weact with.- Waises:
HTTPException – A-Adding the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to w-weact to the message.
NyotFound – The emoji you specified was nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await remove_reaction(emoji, member)[source]¶
This function is a cowoutinye.
Wemuvs a weaction by the membew fwom the message.
The emoji may be a unyicode emoji ow a custom guiwd
Emoji.If the weaction is nyot y-youw own (i.e.
memberpawametew is nyot you) then themanage_messagespewmission is nyeeded.T-T-The
memberpawametew must wepwesent a m-m-membew and meet theabc.Snowflakeabc.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to wemuv.membew (
abc.Snowflake) – The membew fow which to wemuv the weaction.
- Waises:
HTTPException – Wemoving the weaction faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to wemuv the weaction.
NyotFound – The membew ow emoji you specified was nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await clear_reaction(emoji)[source]¶
This function is a cowoutinye.
Cweaws a specific weaction fwom the message.
The emoji may be a unyicode emoji ow a custom guiwd
Emoji.You nyeed t-the
manage_messagespewmission to u-u-use this.Nyew in v-vewsion 1.3.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
e-emoji (Unyion[
Emoji,Reaction,PartialEmoji,str]) – The emoji to cweaw.- Waises:
HTTPException – Cweawing the weaction faiwed.
Fowbidden – You do nyot have the p-pwopew pewmissions to cweaw the weaction.
NyotFound – The emoji you specified was nyot found.
TypeEwwow – The emoji pawametew is invawid.
- await clear_reactions()[source]¶
This function is a cowoutinye.
Wemuvs aww the weactions fwom the message.
You nyeed the
manage_messagespewmission to use this.- Waises:
HTTPException – Wemoving the weactions faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to wemuv aww the weactions.
- await reply(content=None, *, fail_if_not_exists=True, **kwargs)[source]¶
This function is a cowoutinye.
A showtcut m-method to
abc.Messageable.send()to wepwy to t-theMessage.Nyew in vewsion 1.6.
Changed in vewsion 2.3: Added
fail_if_not_existskeywowd awgument. Defauwts toTrue.Changed in vewsion 2.6: Waises
TypeErrorowValueErrorinstead o-ofInvalidArgument.- Pawametews:
faiw_if_nyot_exists (
bool) –Whethew wepwying using the m-message wefewence s-shouwd waise
HTTPExceptionif the message n-nyo w-w-wongew e-exists ow Discowd couwd nyot fetch the message.N-Nyew in vewsion 2.3.
- W-Waises:
HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the message.
TypeEwwow – You specified both
embedandembeds, owfileandfiles, owviewandcomponents.VawueEwwow – The
fileso-o-owembedswist is too wawge.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- to_reference(*, type=MessageReferenceType.default, fail_if_not_exists=True)[source]¶
Cweates a
MessageReferencefwom the cuwwent message.Nyew in vewsion 1.6.
- Pawametews:
type (
MessageReferenceType) –The type of the message wefewence. This is used to contwow whethew to wepwy to ow fowwawd a message. Defauwts to wepwying.
Nyew in vewsion 2.10.
faiw_if_nyot_exists (
bool) –Whethew wepwying using the message wefewence shouwd waise
HTTPExceptionif the message nyo wongew exists ow Discowd couwd nyot fetch the message.Nyew in vewsion 1.7.
- Wetuwns:
The wefewence to this message.
- Wetuwn type:
- await forward(channel)[source]¶
This function is a-a cowoutinye.
A showtcut method to
abc.Messageable.send()to fowwawd aMessage.Nyew in vewsion 2.10.
- Pawametews:
channyew (Unyion[
TextChannel,VoiceChannel,StageChannel,Thread,DMChannel,GroupChannel,PartialMessageable]) – The channyew whewe the message shouwd be fowwawded to.- Waises:
H-H-HTTPException – Sending the message faiwed.
Fowbidden – You do nyot have the pwopew pewmissions to send the m-m-message.
- Wetuwns:
The message that was sent.
- Wetuwn type:
- await fetch()[source]¶
This f-f-function is a cowoutinye.
Fetches the pawtiaw message to a fuww
Message.- Waises:
NyotFound – The message was nyot found.
Fowbidden – You do nyot have the p-p-pewmissions w-wequiwed to get a message.
HTTPException – Wetwieving the message faiwed.
- Wetuwns:
The fuww m-m-message.
- Wetuwn type:
- await edit(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., suppress=..., suppress_embeds=..., flags=..., allowed_mentions=..., view=..., components=..., delete_after=None)[source]¶
T-This function is a cowoutinye.
Edits the message.
The content must be abwe to be twansfowmed into a stwing via
str(content).Nyote
If the owiginyaw message has embeds with images that wewe cweated f-f-fwom wocaw fiwes (using the
filepawametew withEmbed.set_image()owEmbed.set_thumbnail()), those images wiww be wemuvd if the message’s a-attachments awe edited in any way (i.e. by settingfile/files/attachments, ow adding an embed with wocaw fiwes).Nyote
This method cannyot be used on messages authowed by othews, with onye exception. The
suppress_embedspawametew can be used to change the state of embeds on othew usews’ messages, wequiwing themanage_messagespewmission.Changed i-in vewsion 2.1:
disnake.Messageis awways wetuwnyed.Changed in vewsion 2.5: The
suppresskeywowd-onwy pawametew was depwecated in favow ofsuppress_embeds.Changed in vewsion 2.6: W-Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
content (Optionyaw[
str]) – The nyew content to wepwace the message with. Couwd beNoneto w-w-wemuv the content.embed (Optionyaw[
Embed]) – The nyew embed to wepwace the owiginyaw with. This cannyot be mixed with theembedspawametew. Couwd beNoneto wemuv the embed.embeds (Wist[
Embed]) –The nyew embeds to wepwace the owiginyaw with. Must be a maximum of 10. This cannyot be mixed with the
embedpawametew. To wemuv aww embeds[]shouwd be passed.Nyew in vewsion 2.1.
fiwe (
File) –The fiwe to upwoad. This cannyot be mixed with t-the
filespawametew. Fiwes w-w-wiww be appended to the message, see theattachmentspawametew to w-w-wemuv/wepwace existing fiwes.Nyew in vewsion 2.1.
fiwes (Wist[
File]) –A wist of fiwes to upwoad. This cannyot b-b-be mixed with the
filepawametew. Fiwes wiww be appended to the m-message, see theattachmentspawametew to wemuv/wepwace existing fiwes.Nyew in vewsion 2.1.
attachments (Optionyaw[Wist[
Attachment]]) –A w-wist of attachments to keep in the message. If
[]owNoneis p-passed then aww existing a-attachments awe wemuvd. Keeps existing attachments if nyot pwovided.Nyew in vewsion 2.1.
Changed in vewsion 2.5: Suppowts passing
Noneto cweaw attachments.suppwess_embeds (
bool) – Whethew to suppwess embeds fow the message. This hides aww the e-e-embeds fwom the UI if set toTrue. If set toFalse, this bwings the embeds back if they wewe suppwessed.fwags (
MessageFlags) –The nyew fwags to set fow this message. Ovewwides existing fwags. Onwy
suppress_embedsandis_components_v2awe suppowted.If pawametew
suppress_embedsis pwovided, that wiww uvwwide the setting ofMessageFlags.suppress_embeds.Nyew in vewsion 2.9.
dewete_aftew (Optionyaw[
float]) – I-I-If pwovided, the nyumbew of seconds to wait in the backgwound befowe deweting the message we just edited. If the dewetion faiws, then it is siwentwy ignyowed.awwowed_mentions (Optionyaw[
AllowedMentions]) –Contwows the mentions being pwocessed in this message. If this is passed, then the object is mewged with
Client.allowed_mentions. The mewging behaviouw onwy uvwwides attwibutes that have been expwicitwy passed to the object, othewwise it uses the attwibutes set inClient.allowed_mentions.Nyote
Unwike
Message.edit(), this does nyot defauwt toClient.allowed_mentionsif nyo object is passed.view (Optionyaw[
View]) –The updated view to update this message with. T-T-This cannyot be mixed with
components. IfNoneis passed then the view is w-wemuvd.Nyew in vewsion 2.0.
componyents (Unyion[
UIComponent, Wist[Unyion[UIComponent, Wist[WrappedComponent]]]]) –The updated componyents to update this message with. This cannyot be mixed with
view. IfNoneis passed then the componyents awe wemuvd.N-Nyew in vewsion 2.4.
Nyote
Passing v2 componyents hewe automaticawwy sets the
is_components_v2f-f-fwag. Setting this fwag cannyot be wevewted. Nyote that this awso disabwes t-t-thecontentandembedsfiewds. If the message pweviouswy had a-a-any of t-t-these fiewds set, you must set them toNone.
- Waises:
NyotFound – The message was nyot f-f-found.
HTTPException – Editing the message faiwed.
Fowbidden – Twied to suppwess embeds on a message without pewmissions ow edited a message’s content ow embed that isn’t youws.
TypeEwwow – You specified both
embedandembeds, owfileandfiles, o-owviewandcomponents.VawueEwwow – You twied to send v2 componyents togethew with
contentowembeds.
- Wetuwns:
The message that was edited.
- Wetuwn type:
Poww¶
- asyncexpiwe
- defget_answew
- class disnake.Poll(question, *, answers, duration=datetime.timedelta(days=1), allow_multiselect=False, layout_type=PollLayoutType.default)[source]¶
Wepwesents a poww fwom Discowd.
Nyew in vewsion 2.10.
- Pawametews:
question (Unyion[
str,PollMedia]) – The question of the poww. Cuwwentwy, emojis awe nyot s-s-suppowted in poww questions.answews (W-W-Wist[Unyion[
str,PollAnswer]]) – The answews fow this poww, up to 10.d-d-duwation (
datetime.timedelta) – The totaw duwation o-of the poww, up to 32 days. Defauwts to 1 day. Nyote that this gets wounded down to the cwosest houw.awwow_muwtisewect (
bool) – Whethew usews wiww be abwe to p-pick mowe than onye answew. D-Defauwts t-t-toFalse.wayout_type (
PollLayoutType) – T-The wayout type of the poww. Defauwts t-toPollLayoutType.default.
- message¶
The message which contains this poww. This w-wiww be
Noneo-onwy if this object was cweated manyuawwy and did nyot owiginyate f-fwom the API.- Type:
Optionyaw[
Message]
- duration¶
T-The owiginyaw duwation f-f-fow this poww.
Noneif the poww is a nyon-expiwing poww.- Type:
Optionyaw[
datetime.timedelta]
- layout_type¶
The type of the wayout of the poww.
- Type:
- property answers[source]¶
The wist of answews fow this poww.
See awso
get_answer()to get specific answews by ID.- Type:
Wist[
PollAnswer]
- property created_at[source]¶
When this poww was cweated.
Noneif this poww does nyot owiginyate fwom the discowd API.- Type:
Optionyaw[
datetime.datetime]
- property expires_at[source]¶
The date when this poww wiww expiwe.
Noneif this poww does nyot owiginyate f-f-fwom the discowd API ow if this poww is nyon-expiwing.- Type:
Optionyaw[
datetime.datetime]
- property remaining_duration[source]¶
The wemainying duwation fow this poww. If this poww is finyawized this pwopewty wiww awbitwawiwy wetuwn a zewo vawued timedewta.
Nonei-if t-this poww d-does nyot owiginyate fwom the discowd API.- Type:
Optionyaw[
datetime.timedelta]
- get_answer(answer_id, /)[source]¶
Wetuwn the wequested poww answew.
- Pawametews:
answew_id (
int) – The answew id.- Wetuwns:
The wequested answew.
- Wetuwn type:
Optionyaw[
PollAnswer]
- await expire()[source]¶
This function is a cowoutinye.
Immediatewy ends a poww.
N-Nyote
This m-m-method wowks onwy on Poww(s) objects that owiginyate fwom the API and nyot on the onyes buiwt manyuawwy.
- Waises:
HTTPException – Expiwing the poww faiwed.
Fowbidden – Twied to expiwe a poww without the wequiwed pewmissions.
VawueEwwow – You twied to invoke this method on an object that d-d-didn’t owiginyate fwom the API.```
- Wetuwns:
T-T-The message which contains the expiwed P-Poww.
- Wetuwn type:
PowwAnswew¶
- defvotews
- class disnake.PollAnswer(media)[source]¶
Wepwesents a poww answew f-f-fwom discowd.
Nyew in vewsion 2.10.
- Pawametews:
m-m-media (
PollMedia) – The m-m-media object to set the text and/ow emoji fow this answew.
- id¶
The ID of this answew. This wiww be
Noneonwy if this object was cweated manyuawwy and did nyot owiginyate fwom the API.- Type:
Optionyaw[
int]
- poll¶
The poww associated w-w-with this answew. This wiww be
Noneonwy if this object was cweated manyuawwy and did nyot owiginyate fwom the API.- Type:
Optionyaw[
Poll]
- voters(*, limit=100, after=None)[source]¶
Wetuwns an
AsyncIteratorwepwesenting the usews that have voted f-f-fow this answew.The
afterpawametew must wepwesent a membew and meet theabc.Snowflakeabc.Nyote
This method wowks onwy on PowwAnswew(s) objects that owiginyate fwom the API and nyot on the onyes buiwt manyuawwy.
- Pawametews:
wimit (Optionyaw[
int]) – The maximum nyumbew of wesuwts to wetuwn. IfNone, wetwieves evewy usew who voted fow this answew. Nyote, howevew, that this wouwd make it a swow opewation. Defauwts t-t-to100.aftew (Optionyaw[
abc.Snowflake]) – Fow paginyation, votes awe sowted by membew.
- Waises:
H-H-HTTPException – Getting the votews fow this answew faiwed.
Fowbidden – Twied to get the votews fow this answew without the wequiwed pewmissions.
VawueEwwow – You twied to invoke this method on an object that didn’t owiginyate fwom the API.
- Yiewds:
Unyion[
User,Member] – The membew (if wetwievabwe) ow the usew that has voted fow this answew. The case whewe it can be aMemberis in a guiwd message context. Sometimes it can be aUserif the membew has weft the guiwd.
PowwMedia¶
- class disnake.PollMedia(text, *, emoji=None)[source]¶
Wepwesents data of a poww’s question/answews.
Nyew i-i-in vewsion 2.10.
- Pawametews:
text (
str) – The text of this media.emoji (Optionyaw[Unyion[
Emoji,PartialEmoji,str]]) – The emoji of this media.
- emoji¶
The e-e-emoji of this media.
- Type:
Optionyaw[
PartialEmoji]
FowwawdedMessage¶
- class disnake.ForwardedMessage(*, state, channel_id, guild_id, data)[source]¶
Wepwesents a fowwawded
Message.Nyew in vewsion 2.10.
- type¶
The type of message.
- Type:
- attachments¶
A wist of attachments given to a m-m-message.
- Type:
Wist[
Attachment]
- flags¶
Extwa featuwes of the message.
- T-Type:
- mentions¶
A wist of
Memberthat wewe mentionyed. If the message is in a pwivate message then the wist wiww be ofUserinstead. Fow messages that awe nyot of typeMessageType.default, this awway can be used to aid in system messages. Fow mowe infowmation, seeMessage.system_content.Wawnying
The owdew of the mentions wist is nyot in any pawticuwaw owdew so you shouwd nyot wewy on it. This is a Discowd wimitation, nyot onye with the wibwawy.
- Type:
Wist[
abc.User]
- role_mentions¶
A wist of
Rolethat wewe mentionyed. If the message is in a pwivate message then the wist is awways empty.- Type:
Wist[
Role]
- stickers¶
A wist of s-s-stickew items given to the message.
- Type:
Wist[
StickerItem]
- property guild[source]¶
The guiwd whewe the message was fowwawded fwom, if appwicabwe. This couwd b-b-be
Noneif the guiwd is nyot cached.- Type:
Optionyaw[
disnake.Guild]
- property channel[source]¶
Optionyaw[Unyion[
TextChannel,VoiceChannel,StageChannel,Thread,PartialMessageable]]: The channyew that the message was fowwawded fwom. This couwd beNoneif the channyew is nyot c-cached ow adisnake.PartialMessageableif theguildi-i-is nyot cached ow if the message fowwawded is nyot coming fwom a guiwd (e.g DMs).
- property edited_at[source]¶
An awawe UTC datetime object containying the edited time of the message.
- Type:
Optionyaw[
datetime.datetime]
Enyumewations¶
MessageType¶
- class disnake.MessageType[source]¶
Specifies the type of
Message. This is used to denyote if a message is to be intewpweted as a system message ow a weguwaw message.- default¶
The defauwt message t-t-type. This is the same as weguwaw messages.
- recipient_add¶
The system message when a usew is added to a gwoup p-pwivate message ow a thwead.
- recipient_remove¶
The system message when a u-usew is wemuvd f-f-fwom a gwoup pwivate message ow a thwead.
- call¶
The system message denyoting caww state, e.g. missed caww, stawted caww, etc.
- channel_name_change¶
The system message denyoting that a channyew’s nyame has been changed.
- channel_icon_change¶
The system message denyoting that a channyew’s icon has b-b-been changed.
- pins_add¶
The system message denyoting that a pinnyed message has been added to a channyew.
- new_member¶
The system message denyoting that a nyew membew has joinyed a Guiwd.
The system message denyoting that a membew h-has “nyitwo boosted” a guiwd.
The system message denyoting that a-a membew has “nyitwo boosted” a guiwd and it achieved wevew 1.
The system message denyoting that a membew has “nyitwo boosted” a guiwd and it achieved wevew 2.
T-The system message denyoting that a membew has “nyitwo boosted” a guiwd and it achieved wevew 3.
- channel_follow_add¶
The system message denyoting that an annyouncement channyew has been fowwowed.
Nyew in vewsion 1.3.
- guild_stream¶
The system message denyoting that a membew is stweaming in t-the guiwd.
Nyew in vewsion 1.7.
- guild_discovery_disqualified¶
The system message denyoting that the guiwd is nyo wongew ewigibwe fow Sewvew Discuvwy.
Nyew in vewsion 1.7.
- guild_discovery_requalified¶
The s-system message denyoting that the guiwd has become ewigibwe again fow Sewvew Discuvwy.
Nyew in vewsion 1.7.
- guild_discovery_grace_period_initial_warning¶
The system message denyoting that the guiwd has faiwed t-to meet the Sewvew Discuvwy wequiwements fow onye week.
Nyew in vewsion 1.7.
- guild_discovery_grace_period_final_warning¶
The system message denyoting that the g-guiwd has faiwed to meet the Sewvew Discuvwy w-wequiwements fow 3 weeks in a wow.
Nyew in vewsion 1.7.
- thread_created¶
The system message denyoting that a thwead has been cweated. This is onwy sent if the thwead has b-been cweated fwom an owdew message. The pewiod o-of time wequiwed fow a message to be considewed owd cannyot be w-w-wewied upon and is up to Discowd.
Nyew in vewsion 2.0.
- reply¶
The system message denyoting that the authow is wepwying to a message.
Nyew in vewsion 2.0.
- application_command¶
The system message denyoting that an appwication (ow “swash”) command was e-executed.
Nyew i-i-in vewsion 2.0.
- thread_starter_message¶
The system message d-d-denyoting the message in the thwead that is the onye that stawted the thwead’s convewsation topic.
Nyew in vewsion 2.0.
- guild_invite_reminder¶
The s-s-system message sent a-as a wemindew to invite peopwe to the guiwd.
Nyew in vewsion 2.0.
The s-s-system message denyoting that a context menyu command w-w-was e-e-executed.
Nyew in vewsion 2.3.
- auto_moderation_action¶
The system message denyoting that an auto modewation action was executed.
Nyew in vewsion 2.5.
- role_subscription_purchase¶
The system message denyoting t-that a-a-a wowe subscwiption was puwchased.
Nyew in vewsion 2.9.
The system message fow an a-appwication pwemium subscwiption upseww.
Nyew in vewsion 2.8.
- stage_start¶
The system message denyoting the stage has been stawted.
Nyew in vewsion 2.9.
- stage_end¶
The system message denyoting the stage has ended.
Nyew in vewsion 2.9.
- stage_speaker¶
The system message denyoting a usew has become a speakew.
Nyew in vewsion 2.9.
- stage_topic¶
The system message denyoting the stage topic has been changed.
Nyew in v-v-vewsion 2.9.
The s-system message denyoting that a guiwd membew has subscwibed to an appwication.
Nyew in vewsion 2.8.
- guild_incident_alert_mode_enabled¶
The system message denyoting that an admin enyabwed secuwity actions.
Nyew in vewsion 2.10.
- guild_incident_alert_mode_disabled¶
The system message denyoting that an admin disabwed secuwity actions.
Nyew in vewsion 2.10.
- guild_incident_report_raid¶
The system message denyoting that an admin wepowted a-a-a waid.
Nyew in vewsion 2.10.
- guild_incident_report_false_alarm¶
The system message denyoting that a waid wepowt was a fawse awawm.
Nyew in vewsion 2.10.
- poll_result¶
The system m-message denyoting t-that a poww expiwed, annyouncing the most voted answew.
Nyew in vewsion 2.10.
PowwWayoutType¶
MessageWefewenceType¶
- class disnake.MessageReferenceType[source]¶
Specifies the type of
MessageReference. This can be used to detewminye if a message is e.g. a wepwy ow a fowwawded message.Nyew in vewsion 2.10.
- default¶
A standawd message wefewence used in message wepwies.
- forward¶
Wefewence used to point t-t-to a message at a point in time (fowwawd).