hikari.presences#
Application and entities that are used to describe guilds on Discord.
Module Contents#
- class hikari.presences.ActivityType[source]#
Bases:
int
,hikari.internal.enums.Enum
The activity type.
- STREAMING = 1[source]#
Shows up as
Streaming
and links to a Twitch or YouTube stream/video.Warning
You MUST provide a valid Twitch or YouTube stream URL to the activity you create in order for this to be valid. If you fail to do this, then the activity WILL NOT update.
- class hikari.presences.ActivityTimestamps[source]#
The datetimes for the start and/or end of an activity session.
- start: Optional[datetime.datetime][source]#
When this activity’s session was started, if applicable.
- end: Optional[datetime.datetime][source]#
When this activity’s session will end, if applicable.
- class hikari.presences.ActivityAssets[source]#
Used to represent possible assets for an activity.
- property large_image_url: Optional[hikari.files.URL][source]#
Large image asset URL.
Note
This will be
None
if no large image asset exists or if the asset’s dynamic URL (indicated by a{name}:
prefix) is not known.
- property small_image_url: Optional[hikari.files.URL][source]#
Small image asset URL.
Note
This will be
None
if no large image asset exists or if the asset’s dynamic URL (indicated by a{name}:
prefix) is not known.
- large_text: Optional[str][source]#
The text that’ll appear when hovering over the large image, if set.
- small_text: Optional[str][source]#
The text that’ll appear when hovering over the small image, if set.
- make_large_image_url(*, ext='png', size=4096)[source]#
Generate the large image asset URL for this application.
Note
ext
andsize
are ignored for images hosted outside of Discord or on Discord’s media proxy.- Parameters
- Returns
typing.Optional
[hikari.files.URL
]The URL, or
None
if no icon exists.
- Raises
ValueError
If the size is not an integer power of 2 between 16 and 4096 (inclusive).
RuntimeError
If
ActivityAssets.large_image
points towards an unknown asset type.
- make_small_image_url(*, ext='png', size=4096)[source]#
Generate the small image asset URL for this application.
- Parameters
- Returns
typing.Optional
[hikari.files.URL
]The URL, or
None
if no icon exists.
- Raises
ValueError
If the size is not an integer power of 2 between 16 and 4096 (inclusive).
RuntimeError
If
ActivityAssets.small_image
points towards an unknown asset type.
- class hikari.presences.ActivitySecret[source]#
The secrets used for interacting with an activity party.
- class hikari.presences.ActivityFlag[source]#
Bases:
hikari.internal.enums.Flag
Flags that describe what an activity includes.
This can be more than one using bitwise-combinations.
- class hikari.presences.Activity[source]#
Represents a regular activity that can be associated with a presence.
- type: Union[ActivityType, int][source]#
The activity type.
- class hikari.presences.RichActivity[source]#
Bases:
Activity
Represents a rich activity that can be associated with a presence.
- created_at: datetime.datetime[source]#
When this activity was added to the user’s session.
- timestamps: Optional[ActivityTimestamps][source]#
The timestamps for when this activity’s current state will start and end, if applicable.
- application_id: Optional[hikari.snowflakes.Snowflake][source]#
The ID of the application this activity is for, if applicable.
- details: Optional[str][source]#
The text that describes what the activity’s target is doing, if set.
- emoji: Optional[hikari.emojis.Emoji][source]#
The emoji of this activity, if it is a custom status and set.
- party: Optional[ActivityParty][source]#
Information about the party associated with this activity, if set.
- assets: Optional[ActivityAssets][source]#
Images and their hover over text for the activity.
- secrets: Optional[ActivitySecret][source]#
Secrets for Rich Presence joining and spectating.
- flags: Optional[ActivityFlag][source]#
Flags that describe what the activity includes, if present.
- class hikari.presences.Status[source]#
Bases:
str
,hikari.internal.enums.Enum
The status of a member.
- class hikari.presences.MemberPresence[source]#
Used to represent a guild member’s presence.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- user_id: hikari.snowflakes.Snowflake[source]#
The ID of the user this presence belongs to.
- guild_id: hikari.snowflakes.Snowflake[source]#
The ID of the guild this presence belongs to.
- visible_status: Union[Status, str][source]#
This user’s current status being displayed by the client.
- activities: Sequence[RichActivity][source]#
All active user activities.
You can assume the first activity is the one that the GUI Discord client will show.
- client_status: ClientStatus[source]#
Platform-specific user-statuses.
- async fetch_user()[source]#
Fetch the user this presence is for.
- Returns
hikari.users.User
The requested user.
- Raises
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.NotFoundError
If the user is not found.
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request.hikari.errors.RateLimitedError
Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- async fetch_member()[source]#
Fetch the member this presence is for.
- Returns
hikari.guilds.Member
The requested member.
- Raises
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.NotFoundError
If the user is not found.
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request.hikari.errors.RateLimitedError
Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.