hikari.presences
#
Application and entities that are used to describe guilds on Discord.
Activity
#
Represents a regular activity that can be associated with a presence.
state
class-attribute
instance-attribute
#
The activities state, if set.
This field can be use to set a custom status or provide more information on the activity.
type
class-attribute
instance-attribute
#
type: Union[ActivityType, int] = field(converter=ActivityType, default=PLAYING)
The activity type.
url
class-attribute
instance-attribute
#
The activity URL, if set.
Only valid for hikari.presences.ActivityType.STREAMING
activities.
ActivityAssets
#
Used to represent possible assets for an activity.
large_image
class-attribute
instance-attribute
#
The ID of the asset's large image, if set.
large_image_url
property
#
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.
large_text
class-attribute
instance-attribute
#
The text that'll appear when hovering over the large image, if set.
small_image
class-attribute
instance-attribute
#
The ID of the asset's small image, if set.
small_image_url
property
#
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.
small_text
class-attribute
instance-attribute
#
The text that'll appear when hovering over the small image, if set.
make_large_image_url
#
Generate the large image asset URL for this application.
Note
ext
and size
are ignored for images hosted outside of Discord
or on Discord's media proxy.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
RuntimeError
|
If |
make_small_image_url
#
Generate the small image asset URL for this application.
PARAMETER | DESCRIPTION |
---|---|
ext |
The extension to use for this URL.
Supports
TYPE:
|
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the size is not an integer power of 2 between 16 and 4096 (inclusive). |
RuntimeError
|
If |
ActivityFlag
#
Bases: Flag
Flags that describe what an activity includes.
This can be more than one using bitwise-combinations.
EMBEDDED
class-attribute
instance-attribute
#
An activity that's embedded into a voice channel.
PARTY_PRIVACY_FRIENDS
class-attribute
instance-attribute
#
Party privacy: friends only.
PARTY_PRIVACY_VOICE_CHANNEL
class-attribute
instance-attribute
#
Party privacy: voice channel only.
difference
#
Perform a set difference with the other set.
This will return all flags in this set that are not in the other value.
Equivalent to using the subtraction -
operator.
intersection
#
Return a combination of flags that are set for both given values.
Equivalent to using the "AND" &
operator.
is_disjoint
#
is_subset
#
Return whether another set contains this set or not.
Equivalent to using the "in" operator.
is_superset
#
Return whether this set contains another set or not.
none
#
none(*flags: Self) -> bool
Check if none of the given flags are part of this value.
Note
This is essentially the opposite of hikari.internal.enums.Flag.any
.
RETURNS | DESCRIPTION |
---|---|
bool
|
split
#
split() -> Sequence[Self]
Return a list of all defined atomic values for this flag.
Any unrecognised bits will be omitted for brevity.
The result will be a name-sorted typing.Sequence
of each member
symmetric_difference
#
Return a set with the symmetric differences of two flag sets.
Equivalent to using the "XOR" ^
operator.
For a ^ b
, this can be considered the same as (a - b) | (b - a)
.
ActivityParty
#
ActivitySecret
#
ActivityTimestamps
#
The datetimes for the start and/or end of an activity session.
ActivityType
#
Bases: int
, Enum
The activity type.
CUSTOM
class-attribute
instance-attribute
#
Shows up as <emoji> <name>
.
Warning
As of the time of writing, emoji cannot be used by bot accounts.
STREAMING
class-attribute
instance-attribute
#
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.
ClientStatus
#
MemberPresence
#
Used to represent a guild member's presence.
activities
class-attribute
instance-attribute
#
activities: Sequence[RichActivity] = field(eq=False, hash=False, repr=False)
All active user activities.
You can assume the first activity is the one that the GUI Discord client will show.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
client_status
class-attribute
instance-attribute
#
client_status: ClientStatus = field(eq=False, hash=False, repr=False)
Platform-specific user-statuses.
guild_id
class-attribute
instance-attribute
#
The ID of the guild this presence belongs to.
user_id
class-attribute
instance-attribute
#
The ID of the user this presence belongs to.
visible_status
class-attribute
instance-attribute
#
This user's current status being displayed by the client.
fetch_member
async
#
fetch_member() -> Member
Fetch the member this presence is for.
RETURNS | DESCRIPTION |
---|---|
Member
|
The requested member. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_user
async
#
fetch_user() -> User
Fetch the user this presence is for.
RETURNS | DESCRIPTION |
---|---|
User
|
The requested user. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
RichActivity
#
Bases: Activity
Represents a rich activity that can be associated with a presence.
application_id
class-attribute
instance-attribute
#
The ID of the application this activity is for, if applicable.
assets
class-attribute
instance-attribute
#
assets: Optional[ActivityAssets] = field(repr=False)
Images and their hover over text for the activity.
buttons
class-attribute
instance-attribute
#
A sequence of up to 2 of the button labels shown in this rich presence.
created_at
class-attribute
instance-attribute
#
When this activity was added to the user's session.
details
class-attribute
instance-attribute
#
The text that describes what the activity's target is doing, if set.
emoji
class-attribute
instance-attribute
#
The emoji of this activity, if it is a custom status and set.
flags
class-attribute
instance-attribute
#
flags: Optional[ActivityFlag] = field(repr=False)
Flags that describe what the activity includes, if present.
is_instance
class-attribute
instance-attribute
#
Whether this activity is an instanced game session.
party
class-attribute
instance-attribute
#
party: Optional[ActivityParty] = field(repr=False)
Information about the party associated with this activity, if set.
secrets
class-attribute
instance-attribute
#
secrets: Optional[ActivitySecret] = field(repr=False)
Secrets for Rich Presence joining and spectating.
state
class-attribute
instance-attribute
#
The activities state, if set.
This field can be use to set a custom status or provide more information on the activity.
timestamps
class-attribute
instance-attribute
#
timestamps: Optional[ActivityTimestamps] = field(repr=False)
The timestamps for when this activity's current state will start and end, if applicable.
type
class-attribute
instance-attribute
#
type: Union[ActivityType, int] = field(converter=ActivityType, default=PLAYING)
The activity type.
url
class-attribute
instance-attribute
#
The activity URL, if set.
Only valid for hikari.presences.ActivityType.STREAMING
activities.