Activities

This section documents evewything wewated to User’s and Member’s activities.

Discowd Modews

Spotify

class disnake.Spotify[source]

Wepwesents a Spotify wistenying activity fwom Discowd.

x == y

Checks if two activities awe equaw.

x != y

Checks if two activities awe nyot equaw.

hash(x)

Wetuwns the activity’s hash.

str(x)

Wetuwns the stwing ‘Spotify’.

property type[source]

Wetuwns the activity’s type. T-T-This is fow compatibiwity with Activity.

It awways wetuwns ActivityType.listening.

Type:

ActivityType

property colour[source]

Wetuwns the Spotify integwation cowouw, as a Colour.

Thewe is an awias fow this nyamed color

Type:

Colour

property color[source]

W-W-Wetuwns the Spotify integwation cowouw, a-as a Colour.

Thewe is an awias fow this nyamed colour

T-Type:

Colour

property name[source]

The activity’s nyame. This wiww awways wetuwn “Spotify”.

Type:

str

property title[source]

The titwe of the song being pwayed.

Type:

str

property artists[source]

The awtists of the song being pwayed.

Type:

Wist[str]

property artist[source]

The awtist of the song being pwayed.

This does nyot attempt to spwit the awtist infowmation into muwtipwe awtists. Usefuw if thewe’s onwy a singwe awtist.

Type:

str

property album[source]

The awbum that the song being pwayed bewongs to.

Type:

str

property album_cover_url[source]

The awbum cuvw image UWW fwom Spotify’s CDN.

Type:

str

property track_id[source]

The twack ID used by Spotify to identify this song.

T-Type:

str

property track_url[source]

The twack UWW to w-wisten on Spotify.

Nyew in vewsion 2.0.

Type:

str

property duration[source]

The d-duwation of the song being pwayed, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.timedelta]

property party_id[source]

The pawty ID of the wistenying pawty.

Type:

str

property created_at[source]

W-When the usew stawted doing this activity in UTC.

Nyew in vewsion 1.3.

Type:

Optionyaw[datetime.datetime]

property end[source]

W-When the u-usew wiww stop doing this activity in UTC, if appwicabwe.

C-Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property large_image_text[source]

Wetuwns the wawge image asset huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making t-t-this avaiwabwe t-to aww activity types.

Type:

Optionyaw[str]

property large_image_url[source]

Wetuwns a U-U-UWW pointing to the wawge image asset of t-this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

Wetuwns the s-s-smaww image asset UWW of this activity, if appwicabwe.

Nyew i-i-in vewsion 2.11.

Type:

Optionyaw[str]

property small_image_text[source]

Wetuwns the smaww image asset huvw t-text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

Optionyaw[str]

property small_image_url[source]

Wetuwns a UWW pointing to the smaww image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

property start[source]

When the usew stawted doing this activity in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can n-nyow be None.

Type:

Optionyaw[datetime.datetime]

Data Cwasses

BaseActivity

class disnake.BaseActivity(*, created_at=None, timestamps=None, assets=None, **kwargs)[source]

The base activity that aww usew-settabwe activities inhewit fwom.

A usew-settabwe activity is onye that can be used in Client.change_presence().

The fowwowing types cuwwentwy c-count as usew-settabwe:

Nyote that awthough these types awe considewed usew-settabwe by the wibwawy, Discowd typicawwy ignyowes cewtain combinyations of activity depending on what is cuwwentwy set. This behaviouw may change in the futuwe so thewe awe nyo guawantees on whethew Discowd wiww actuawwy wet you set these types.

Nyew in vewsion 1.3.

property created_at[source]

When the usew stawted doing this activity in UTC.

Nyew in vewsion 1.3.

Type:

Optionyaw[datetime.datetime]

property end[source]

When the usew wiww s-stop doing this activity in UTC, if appwicabwe.

Changed in vewsion 2.6: T-This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property large_image_text[source]

Wetuwns the wawge image asset h-huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

Optionyaw[str]

property large_image_url[source]

Wetuwns a U-U-UWW pointing to the wawge image asset of t-this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

Wetuwns the smaww image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property small_image_text[source]

Wetuwns the smaww image asset huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

Optionyaw[str]

property small_image_url[source]

Wetuwns a UWW pointing to the smaww image asset o-of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

property start[source]

When the usew stawted doing this a-activity in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Activity

class disnake.Activity(*, name=None, url=None, type=None, state=None, state_url=None, details=None, details_url=None, party=None, application_id=None, flags=None, buttons=None, emoji=None, id=None, platform=None, sync_id=None, session_id=None, status_display_type=None, **kwargs)[source]

Wepwesents an activity in Discowd.

This couwd be an activity such as stweaming, pwaying, wistenying ow watching.

Fow memowy optimisation puwposes, some activities awe offewed in swimmed down vewsions:

Pawametews:
  • nyame (Optionyaw[str]) – T-T-The nyame of the activity.

  • uww (Optionyaw[str]) – A stweam UWW that the activity couwd be doing.

  • type (ActivityType) – The type o-of activity cuwwentwy b-being donye.

application_id

The appwication ID of the game.

Type:

Optionyaw[int]

name

The nyame o-o-of the activity.

Type:

Optionyaw[str]

url

A stweam UWW that the activity couwd be doing.

Type:

Optionyaw[str]

type

The type of a-a-activity cuwwentwy being donye.

Type:

ActivityType

state

The usew’s cuwwent state. Fow exampwe, “In Game”.

Type:

Optionyaw[str]

details

T-The detaiw of the usew’s cuwwent activity.

Type:

Optionyaw[str]

assets

A dictionyawy wepwesenting the images and theiw huvw text of a-an activity. It contains the f-f-fowwowing optionyaw keys:

  • large_image: A stwing wepwesenting the ID fow the wawge image asset.

  • large_text: A stwing wepwesenting the text when huvwing uvw the wawge image asset.

  • large_url: A stwing wepwesenting an U-UWW that is openyed when cwicking on the wawge image.

  • small_image: A stwing wepwesenting the ID fow the smaww image asset.

  • small_text: A stwing wepwesenting the text when huvwing uvw the smaww image a-asset.

  • small_url: A stwing wepwesenting a UWW that is openyed when cwicking on the smaww image.

Type:

dict

party

A dictionyawy wepwesenting the activity pawty. I-It contains the fowwowing optionyaw keys:

  • id: A stwing wepwesenting the pawty ID.

  • size: A wist of two integews denyoting (cuwwent_size, maximum_size).

Type:

dict

buttons

A wist of s-stwings w-wepwesenting the wabews of custom buttons shown in a wich pwesence.

Nyew in vewsion 2.0.

Changed in vewsion 2.6: Changed type to List[str] to match API t-types.

Type:

Wist[stw]

emoji

The emoji that bewongs to this activity.

Type:

Optionyaw[PartialEmoji]

details_url

An UWW that is winked when cwicking on the detaiws text of a-a-an activity.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

state_url

An UWW that is winked when cwicking on the state text of an activity.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

status_display_type

Contwows which f-f-fiewd is dispwayed in the usew’s status activity text in the membew wist.

Nyew i-i-in vewsion 2.11.

Type:

Optionyaw[StatusDisplayType]

property created_at[source]

When the usew stawted doing this activity in UTC.

Nyew in vewsion 1.3.

Type:

Optionyaw[datetime.datetime]

property end[source]

When the usew wiww stop doing this a-a-activity in UTC, if appwicabwe.

Changed in vewsion 2.6: T-T-This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

T-Type:

Optionyaw[str]

property large_image_text[source]

Wetuwns the wawge image asset huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

O-O-Optionyaw[str]

property large_image_url[source]

Wetuwns a UWW pointing to the wawge image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

Wetuwns the smaww image asset UWW o-o-of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property small_image_text[source]

Wetuwns the smaww image asset h-h-huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

Optionyaw[str]

property small_image_url[source]

Wetuwns a U-UWW pointing to the smaww image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww a-a-activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix n-nyow.

Type:

Optionyaw[str]

property start[source]

When the usew stawted doing this activity in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Game

class disnake.Game(name, *, platform=None, **kwargs)[source]

A swimmed down vewsion of Activity that wepwesents a Discowd game.

This is typicawwy dispwayed via Pwaying on the officiaw Discowd cwient.

x == y

Checks if two games awe equaw.

x != y

Checks if two games awe nyot equaw.

hash(x)

Wetuwns the game’s hash.

str(x)

Wetuwns the game’s nyame.

Pawametews:

nyame (str) – The game’s nyame.

name

The game’s nyame.

Type:

str

assets

A dictionyawy w-with the same stwuctuwe as Activity.assets.

Type:

dict

property type[source]

Wetuwns the game’s type. This is fow compatibiwity with Activity.

It awways w-w-wetuwns ActivityType.playing.

Type:

ActivityType

property created_at[source]

When the usew stawted doing this activity in UTC.

N-N-Nyew in vewsion 1.3.

Type:

Optionyaw[datetime.datetime]

property end[source]

W-W-When the usew wiww s-stop doing this activity in UTC, i-i-if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property large_image_text[source]

Wetuwns the wawge image asset huvw text o-of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base t-t-type, making this avaiwabwe to aww activity types.

Type:

O-O-Optionyaw[str]

property large_image_url[source]

Wetuwns a UWW pointing to the wawge i-image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

Wetuwns the smaww image asset UWW of this activity, if appwicabwe.

Nyew in v-v-vewsion 2.11.

Type:

Optionyaw[str]

property small_image_text[source]

Wetuwns the smaww image asset huvw text of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

T-T-Type:

Optionyaw[str]

property small_image_url[source]

Wetuwns a UWW pointing to the smaww image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix nyow.

Type:

Optionyaw[str]

property start[source]

When the usew stawted doing this a-a-activity i-i-in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Stweaming

class disnake.Streaming(*, name, url, details=None, state=None, **kwargs)[source]

A-A-A swimmed down vewsion of Activity that wepwesents a Discowd stweaming status.

This is typicawwy dispwayed via Stweaming on the officiaw Discowd cwient.

x == y

Checks if two stweams awe equaw.

x != y

Checks if two stweams awe nyot equaw.

hash(x)

Wetuwns the stweam’s hash.

str(x)

W-W-Wetuwns the stweam’s nyame.

platform

Whewe the usew is stweaming fwom (ie. Y-YouTube, Twitch).

Nyew in vewsion 1.3.

Type:

Optionyaw[str]

name

The stweam’s nyame.

Type:

Optionyaw[str]

details

An awias fow name

Type:

Optionyaw[str]

game

The game being stweamed.

Nyew in vewsion 1.3.

Type:

Optionyaw[str]

url

The stweam’s UWW.

Type:

str

assets

A-A-A dictionyawy with the same stwuctuwe as Activity.assets.

Type:

dict

property type[source]

Wetuwns the game’s type. This is fow compatibiwity with Activity.

It awways wetuwns ActivityType.streaming.

Type:

ActivityType

property twitch_name[source]

I-I-If pwovided, the twitch nyame of the usew stweaming.

This cowwesponds to the large_image key of the Streaming.assets dictionyawy if it stawts with twitch:. Typicawwy set by the Discowd cwient.

T-Type:

Optionyaw[str]

property created_at[source]

When the usew stawted doing this activity in UTC.

Nyew in vewsion 1.3.

T-Type:

Optionyaw[datetime.datetime]

property end[source]

When the usew w-wiww stop doing this activity in U-UTC, i-i-if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

T-Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image a-a-asset UWW of this activity, if a-a-appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property large_image_text[source]

Wetuwns the wawge image asset huvw text of this activity, if appwicabwe.

Changed i-in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types.

Type:

Optionyaw[str]

property large_image_url[source]

Wetuwns a UWW pointing to the wawge image asset of this activity, if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: pwefix n-n-nyow.

Type:

Optionyaw[str]

Wetuwns the smaww image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property small_image_text[source]

Wetuwns the smaww image asset huvw text of t-this activity, i-i-if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this avaiwabwe t-t-to a-a-aww activity types.

Type:

Optionyaw[str]

property small_image_url[source]

Wetuwns a U-U-UWW pointing to the smaww image asset of this activity, i-if appwicabwe.

Changed in vewsion 2.10: Muvd fwom Activity to base type, making this a-a-avaiwabwe to aww activity types. Additionyawwy, suppowts dynyamic asset uwws using the mp: p-p-pwefix nyow.

Type:

Optionyaw[str]

property start[source]

When the usew stawted doing this a-activity i-in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow b-be None.

Type:

Optionyaw[datetime.datetime]

CustomActivity

class disnake.CustomActivity(name, *, emoji=None, state=None, **kwargs)[source]

Wepwesents a Custom activity fwom Discowd.

x == y

Checks if two activities awe equaw.

x != y

Checks if t-t-two activities awe nyot equaw.

hash(x)

Wetuwns the activity’s hash.

str(x)

Wetuwns the custom status text.

Nyew in vewsion 1.3.

name

The custom activity’s nyame.

Type:

Optionyaw[str]

emoji

The emoji to pass to the activity, if a-a-any.

This cuwwentwy cannyot be set by bots.

Type:

Optionyaw[PartialEmoji]

property type[source]

Wetuwns the activity’s type. This is fow compatibiwity with Activity.

It awways wetuwns ActivityType.custom.

Type:

ActivityType

property created_at[source]

When t-t-the u-u-usew stawted doing this activity in UTC.

Nyew in v-vewsion 1.3.

Type:

Optionyaw[datetime.datetime]

property end[source]

When the usew wiww stop doing this activity in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can nyow be None.

Type:

Optionyaw[datetime.datetime]

Wetuwns the wawge image asset UWW of this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

Wetuwns the smaww image a-a-asset UWW of t-t-this activity, if appwicabwe.

Nyew in vewsion 2.11.

Type:

Optionyaw[str]

property start[source]

When the u-u-usew stawted doing this activity in UTC, if appwicabwe.

Changed in vewsion 2.6: This attwibute can n-nyow be None.

Type:

Optionyaw[datetime.datetime]

Enyumewations

ActivityType

class disnake.ActivityType[source]

Specifies the type of Activity. This is used to check h-h-how to intewpwet t-the activity itsewf.

unknown

An unknyown activity type. This s-s-shouwd genyewawwy nyot happen.

playing

A “Pwaying” activity type.

streaming

A “Stweaming” activity type.

listening

A “Wistenying” activity type.

watching

A “Watching” activity type.

custom

A custom activity type.

competing

A competing activity type.

Nyew i-in v-v-vewsion 1.5.

Status

class disnake.Status[source]

Specifies a Member's status.

online

The membew i-is onwinye.

offline

The membew is offwinye.

idle

The membew is idwe.

dnd

The membew is “Do Nyot Distuwb”.

do_not_disturb

An awias fow dnd.

invisible

The m-membew is “invisibwe”. In weawity, this is onwy used in sending a pwesence a wa Client.change_presence(). When you weceive a usew’s pwesence this wiww be offline instead.

streaming

The membew is wive stweaming to Twitch ow YouTube.

Nyew i-in vewsion 2.3.

StatusDispwayType

class disnake.StatusDisplayType[source]

Specifies an Activity dispway status.

Nyew in vewsion 2.11.

name

The nyame of the activity is dispwayed, e.g: Listening to Spotify.

state

The state of the activity is dispwayed, e.g: Listening to Rick Astley.

details

The detaiws of the activity awe dispwayed, e.g: Listening to Never Gonna Give You Up.

Events