hikari.api.shard
#
Provides an interface for gateway shard implementations to conform to.
GatewayDataFormat #
GatewayShard #
Bases: ABC
Interface for a definition of a v10 compatible websocket gateway.
Each instance should represent a single shard.
heartbeat_latency abstractmethod
property
#
heartbeat_latency: float
Shard's most recent heartbeat latency.
If the information is not yet available, then this will be float('nan')
instead.
shard_count abstractmethod
property
#
shard_count: int
Return the total number of shards expected in the entire application.
get_user_id abstractmethod
#
get_user_id() -> Snowflake
Return the user ID.
RETURNS | DESCRIPTION |
---|---|
Snowflake | The user ID for the application user. |
join abstractmethod
async
#
join() -> None
Wait indefinitely until the websocket closes.
This can be placed in a task and cancelled without affecting the websocket runtime itself.
request_guild_members abstractmethod
async
#
request_guild_members(guild: SnowflakeishOr[PartialGuild], *, include_presences: UndefinedOr[bool] = undefined.UNDEFINED, query: str = '', limit: int = 0, users: UndefinedOr[SnowflakeishSequence[User]] = undefined.UNDEFINED, nonce: UndefinedOr[str] = undefined.UNDEFINED) -> None
Request for a guild chunk.
Note
To request the full list of members, set query
to ""
(empty string) and limit
to 0
.
PARAMETER | DESCRIPTION |
---|---|
guild | The guild to request chunk for. TYPE: |
include_presences | If provided, whether to request presences. TYPE: |
query | If not TYPE: |
limit | Maximum number of members to send matching the query. TYPE: |
users | If provided, the users to request for. TYPE: |
nonce | If provided, the nonce to be sent with guild chunks. TYPE: |
RAISES | DESCRIPTION |
---|---|
ValueError | If trying to specify |
MissingIntentError | When trying to request presences without the |
update_presence abstractmethod
async
#
update_presence(*, idle_since: UndefinedNoneOr[datetime] = undefined.UNDEFINED, afk: UndefinedOr[bool] = undefined.UNDEFINED, activity: UndefinedNoneOr[Activity] = undefined.UNDEFINED, status: UndefinedOr[Status] = undefined.UNDEFINED) -> None
Update the presence of the shard user.
If the shard is not alive, no physical data will be sent, however, the new presence settings will be remembered for when the shard does connect.
PARAMETER | DESCRIPTION |
---|---|
idle_since | The datetime that the user started being idle. If undefined, this will not be changed. TYPE: |
afk | Whether to mark the user as AFK. If undefined, this will not be changed. TYPE: |
activity | The activity to appear to be playing. If undefined, this will not be changed. TYPE: |
status | The web status to show. If undefined, this will not be changed. TYPE: |
update_voice_state abstractmethod
async
#
update_voice_state(guild: SnowflakeishOr[PartialGuild], channel: Optional[SnowflakeishOr[GuildVoiceChannel]], *, self_mute: UndefinedOr[bool] = undefined.UNDEFINED, self_deaf: UndefinedOr[bool] = undefined.UNDEFINED) -> None
Update the voice state for this shard in a given guild.
PARAMETER | DESCRIPTION |
---|---|
guild | The guild or guild ID to update the voice state for. TYPE: |
channel | The channel or channel ID to update the voice state for. If TYPE: |
self_mute | If specified and TYPE: |
self_deaf | If specified and TYPE: |