hikari.presences#
Application and entities that are used to describe guilds on Discord.
Module Contents#
- class hikari.presences.Activity[source]#
Represents a regular activity that can be associated with a presence.
- type: ActivityType | int[source]#
The activity type.
- class hikari.presences.ActivityAssets[source]#
Used to represent possible assets for an activity.
- property large_image_url: hikari.files.URL | None[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: hikari.files.URL | None[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.
- 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.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.ActivitySecret[source]#
The secrets used for interacting with an activity party.
- class hikari.presences.ActivityTimestamps[source]#
The datetimes for the start and/or end of an activity session.
- end: datetime.datetime | None[source]#
When this activity’s session will end, if applicable.
- start: datetime.datetime | None[source]#
When this activity’s session was started, if applicable.
- class hikari.presences.ActivityType[source]#
Bases:
int
,hikari.internal.enums.Enum
The activity type.
- CUSTOM = 4[source]#
A custom status.
To set an emoji with the status, place a unicode emoji or Discord emoji (
:smiley:
) as the first part of the status activity name.Warning
Bots DO NOT support setting custom statuses.
- class hikari.presences.MemberPresence[source]#
Used to represent a guild member’s presence.
- activities: Sequence[RichActivity][source]#
All active user activities.
You can assume the first activity is the one that the GUI Discord client will show.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- client_status: ClientStatus[source]#
Platform-specific user-statuses.
- guild_id: hikari.snowflakes.Snowflake[source]#
The ID of the guild this presence belongs to.
- user_id: hikari.snowflakes.Snowflake[source]#
The ID of the user this presence belongs to.
- 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.InternalServerError
If an internal error occurs on Discord while handling the request.
- 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.InternalServerError
If an internal error occurs on Discord while handling the request.
- class hikari.presences.RichActivity[source]#
Bases:
Activity
Represents a rich activity that can be associated with a presence.
- application_id: hikari.snowflakes.Snowflake | None[source]#
The ID of the application this activity is for, if applicable.
- assets: ActivityAssets | None[source]#
Images and their hover over text for the activity.
- buttons: Sequence[str][source]#
A sequence of up to 2 of the button labels shown in this rich presence.
- created_at: datetime.datetime[source]#
When this activity was added to the user’s session.
- emoji: hikari.emojis.Emoji | None[source]#
The emoji of this activity, if it is a custom status and set.
- flags: ActivityFlag | None[source]#
Flags that describe what the activity includes, if present.
- party: ActivityParty | None[source]#
Information about the party associated with this activity, if set.
- secrets: ActivitySecret | None[source]#
Secrets for Rich Presence joining and spectating.
- timestamps: ActivityTimestamps | None[source]#
The timestamps for when this activity’s current state will start and end, if applicable.