hikari.events.typing_events#

Events fired when users begin typing in channels.

Module Contents#

class hikari.events.typing_events.TypingEvent[source]#

Bases: hikari.events.shard_events.ShardEvent, abc.ABC

Base event fired when a user begins typing in a channel.

abstract property channel_id: hikari.snowflakes.Snowflake[source]#

ID of the channel that this event concerns.

abstract property user_id: hikari.snowflakes.Snowflake[source]#

ID of the user who triggered this typing event.

abstract property timestamp: datetime.datetime[source]#

Timestamp of when this typing event started.

async fetch_channel()[source]#

Perform an API call to fetch an up-to-date image of this channel.

Returns
hikari.channels.TextableChannel

The channel.

get_user()[source]#

Get the cached user that is typing, if known.

Returns
typing.Optional[hikari.users.User]

The user, if known.

async fetch_user()[source]#

Perform an API call to fetch an up-to-date image of this user.

Returns
hikari.users.User

The 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.

trigger_typing()[source]#

Return a typing indicator for this channel that can be awaited.

Returns
hikari.api.special_endpoints.TypingIndicator

A typing indicator context manager and awaitable to trigger typing in a channel with.

class hikari.events.typing_events.GuildTypingEvent[source]#

Bases: TypingEvent

Event fired when a user starts typing in a guild channel.

property user_id: hikari.snowflakes.Snowflake[source]#

ID of the user who triggered this typing event.

guild_id: hikari.snowflakes.Snowflake[source]#

ID of the guild that this event relates to.

member: hikari.guilds.Member[source]#

Object of the member who triggered this typing event.

async fetch_channel()[source]#

Perform an API call to fetch an up-to-date image of this channel.

Returns
hikari.channels.TextableGuildChannel

The channel.

async fetch_guild()[source]#

Perform an API call to fetch an up-to-date image of this guild.

Returns
hikari.guilds.Guild

The guild.

async fetch_guild_preview()[source]#

Perform an API call to fetch an up-to-date preview of this guild.

Returns
hikari.guilds.GuildPreview

The guild.

async fetch_member()[source]#

Perform an API call to fetch an up-to-date image of this event’s member.

Returns
hikari.guilds.Member

The member.

get_channel()[source]#

Get the cached channel object this typing event occurred in.

Returns
typing.Optional[hikari.channels.TextableGuildChannel]

The channel.

get_guild()[source]#

Get the cached object of the guild this typing event occurred in.

If the guild is not found then this will return None.

Returns
typing.Optional[hikari.guilds.GatewayGuild]

The object of the gateway guild if found else None.

class hikari.events.typing_events.DMTypingEvent[source]#

Bases: TypingEvent

Event fired when a user starts typing in a guild channel.

async fetch_channel()[source]#

Perform an API call to fetch an up-to-date image of this channel.

Returns
hikari.channels.DMChannel

The channel.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel 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.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.