hikari.events.channel_events#
Events that fire when channels are modified.
This does not include message events, nor reaction events.
Module Contents#
- class hikari.events.channel_events.ChannelEvent[source]#
Bases:
hikari.events.shard_events.ShardEvent
,abc.ABC
Event base for any channel-bound event in guilds or private messages.
- abstract property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel the event relates to.
- abstract async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
Note
For
GuildChannelDeleteEvent
events, this will always raise an exception, since the channel will have already been removed.- Returns:
hikari.channels.PartialChannel
A derivative of
hikari.channels.PartialChannel
. The actual type will vary depending on the type of channel this event concerns.
- 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.InternalServerError
If an internal error occurs on Discord while handling the request.
- class hikari.events.channel_events.DMChannelEvent[source]#
Bases:
ChannelEvent
,abc.ABC
Event base for any channel-bound event in private messages.
- async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
Note
For
GuildChannelDeleteEvent
events, this will always raise an exception, since the channel will have already been removed.- Returns:
hikari.channels.PrivateChannel
A derivative of
hikari.channels.PrivateChannel
. The actual type will vary depending on the type of channel this event concerns.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.ForbiddenError
If you are missing the
VIEW_CHANNEL
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.InternalServerError
If an internal error occurs on Discord while handling the request.
- class hikari.events.channel_events.DMPinsUpdateEvent[source]#
Bases:
PinsUpdateEvent
,DMChannelEvent
Event fired when a message is pinned/unpinned in a private channel.
- async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
- Returns:
hikari.channels.DMChannel
A derivative of
hikari.channels.DMChannel
. The actual type will vary depending on the type of channel this event concerns.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
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.events.channel_events.GuildChannelCreateEvent[source]#
Bases:
GuildChannelEvent
Event fired when a guild channel is created.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel the event relates to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- channel: hikari.channels.PermissibleGuildChannel[source]#
Guild channel that this event represents.
- class hikari.events.channel_events.GuildChannelDeleteEvent[source]#
Bases:
GuildChannelEvent
Event fired when a guild channel is deleted.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel the event relates to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- channel: hikari.channels.PermissibleGuildChannel[source]#
Guild channel that this event represents.
- class hikari.events.channel_events.GuildChannelEvent[source]#
Bases:
ChannelEvent
,abc.ABC
Event base for any channel-bound event in guilds.
- abstract property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
Note
For
GuildChannelDeleteEvent
events, this will always raise an exception, since the channel will have already been removed.- Returns:
hikari.channels.GuildChannel
A derivative of
hikari.channels.GuildChannel
. The actual type will vary depending on the type of channel this event concerns.
- 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.InternalServerError
If an internal error occurs on Discord while handling the request.
- async fetch_guild()[source]#
Perform an API call to fetch the guild that this event relates to.
- Returns:
hikari.guilds.RESTGuild
The guild that this event occurred in.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.ForbiddenError
If you are not part of the guild.
hikari.errors.NotFoundError
If the guild 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.
- get_channel()[source]#
Get the cached channel that this event relates to, if known.
If not, return
None
.- Returns:
typing.Optional
[hikari.channels.GuildChannel
]The cached channel this event relates to. If not known, this will return
None
instead.
- get_guild()[source]#
Get the cached guild that this event relates to, if known.
If not, return
None
.- Returns:
typing.Optional
[hikari.guilds.GatewayGuild
]The gateway guild this event relates to, if known. Otherwise this will return
None
.
- class hikari.events.channel_events.GuildChannelUpdateEvent[source]#
Bases:
GuildChannelEvent
Event fired when a guild channel is edited.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel the event relates to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- channel: hikari.channels.PermissibleGuildChannel[source]#
Guild channel that this event represents.
- old_channel: hikari.channels.PermissibleGuildChannel | None[source]#
The old guild channel object.
This will be
None
if the channel missing from the cache.
- class hikari.events.channel_events.GuildPinsUpdateEvent[source]#
Bases:
PinsUpdateEvent
,GuildChannelEvent
Event fired when a message is pinned/unpinned in a guild channel.
- async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
- Returns:
hikari.channels.TextableGuildChannel
A derivative of
hikari.channels.TextableGuildChannel
. The actual type will vary depending on the type of channel this event concerns.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.ForbiddenError
If you are missing the
VIEW_CHANNEL
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.InternalServerError
If an internal error occurs on Discord while handling the request.
- get_channel()[source]#
Get the cached channel that this event relates to, if known.
If not, return
None
.- Returns:
typing.Optional
[hikari.channels.TextableGuildChannel
]The cached channel this event relates to. If not known, this will return
None
instead.
- class hikari.events.channel_events.GuildThreadAccessEvent[source]#
Bases:
GuildThreadEvent
Event fired when you’re given access to an existing private thread.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild this event is for.
- property thread_id: hikari.snowflakes.Snowflake[source]#
ID of the thread this event is for.
- thread: hikari.channels.GuildThreadChannel[source]#
The thread that you’ve been given access to.
- class hikari.events.channel_events.GuildThreadCreateEvent[source]#
Bases:
GuildThreadEvent
Event fired when a new thread is created.
This event is fired when you create a private thread or anybody creates a public thread in a channel you can access.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild this event is for.
- property thread_id: hikari.snowflakes.Snowflake[source]#
ID of the thread this event is for.
- thread: hikari.channels.GuildThreadChannel[source]#
The thread that was created.
- class hikari.events.channel_events.GuildThreadDeleteEvent[source]#
Bases:
GuildThreadEvent
Event fired when a thread is deleted.
- parent_id: hikari.snowflakes.Snowflake[source]#
The ID of the channel that the thread was deleted from.
- type: hikari.channels.ChannelType[source]#
The type of thread that was deleted.
- class hikari.events.channel_events.GuildThreadEvent[source]#
Bases:
hikari.events.shard_events.ShardEvent
,abc.ABC
Event base for any event that is related to a guild thread.
- abstract property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild this event is for.
- abstract property thread_id: hikari.snowflakes.Snowflake[source]#
ID of the thread this event is for.
- async fetch_channel()[source]#
Perform an API call to fetch the details about this thread.
Note
For
GuildThreadDeleteEvent
events, this will always raise an exception, since the channel will have already been removed.- Returns:
hikari.channels.GuildThreadChannel
A derivative of
hikari.channels.GuildThreadChannel
. The actual type will vary depending on the type of channel this event concerns.
- 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.InternalServerError
If an internal error occurs on Discord while handling the request.
- class hikari.events.channel_events.GuildThreadUpdateEvent[source]#
Bases:
GuildThreadEvent
Event fired when a thread is updated.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild this event is for.
- property thread_id: hikari.snowflakes.Snowflake[source]#
ID of the thread this event is for.
- thread: hikari.channels.GuildThreadChannel[source]#
The thread that was updated.
- class hikari.events.channel_events.InviteCreateEvent[source]#
Bases:
InviteEvent
Event fired when an invite is created in a channel.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel the event relates to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- invite: hikari.invites.InviteWithMetadata[source]#
Invite that was created.
- class hikari.events.channel_events.InviteDeleteEvent[source]#
Bases:
InviteEvent
Event fired when an invite is deleted from a channel.
- old_invite: hikari.invites.InviteWithMetadata | None[source]#
Object of the old cached invite.
This will be
None
if the invite is missing from the cache.
- class hikari.events.channel_events.InviteEvent[source]#
Bases:
GuildChannelEvent
,abc.ABC
Base event type for guild invite updates.
- async fetch_invite()[source]#
Perform an API call to retrieve an up-to-date image of this invite.
- Returns:
hikari.invites.Invite
The invite object.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.NotFoundError
If the invite 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.events.channel_events.PinsUpdateEvent[source]#
Bases:
ChannelEvent
,abc.ABC
Base event fired when a message is pinned/unpinned in a channel.
- abstract property last_pin_timestamp: datetime.datetime | None[source]#
Datetime of when the most recent message was pinned in the channel.
Will be
None
if nothing is pinned or the information is unavailable.
- abstract async fetch_channel()[source]#
Perform an API call to fetch the details about this channel.
- Returns:
hikari.channels.TextableChannel
A derivative of
hikari.channels.TextableChannel
. The actual type will vary depending on the type of channel this event concerns.
- async fetch_pins()[source]#
Perform an API call to fetch the pinned messages in this channel.
- Returns:
typing.Sequence
[hikari.messages.Message
]The pinned messages in this channel.
- class hikari.events.channel_events.ThreadListSyncEvent[source]#
Bases:
hikari.events.shard_events.ShardEvent
Event fired to sync threads when the bot gains access to one or more channels.
- channel_ids: Sequence[hikari.snowflakes.Snowflake] | None[source]#
IDs of the text channels threads are being synced for.
If this is
None
then threads are being synced for all text channels in the guild.This may contain channels that have no active threads as well to allow for clearing stale data.
- threads: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildThreadChannel][source]#
Mapping of IDs to objects of the active threads in the given channels.
- class hikari.events.channel_events.ThreadMembersUpdateEvent[source]#
Bases:
GuildThreadEvent
Event fired when a thread’s members are updated.
- added_members: Mapping[hikari.snowflakes.Snowflake, hikari.channels.ThreadMember][source]#
Mapping of IDs to objects of the members which were added to the thread.
- approximate_member_count: int[source]#
Approximate count of members in the thread channel.
Warning
This stops counting at 50 for threads created before 2022/06/01.
- guild_members: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Member][source]#
Mapping of IDs to guild member objects of the added thread members.
Will only be filled if the
GUILD_MEMBERS
intent is declared.
- guild_presences: Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence][source]#
Mapping of IDs to guild presence objects of the added members.
Will only be filled if the
GUILD_PRESENCES
intent is declared.
- removed_member_ids: Sequence[hikari.snowflakes.Snowflake][source]#
Sequence of IDs of users which were removed from the thread.
- class hikari.events.channel_events.WebhookUpdateEvent[source]#
Bases:
GuildChannelEvent
Event fired when a webhook is created/updated/deleted in a channel.
Unfortunately, Discord does not provide any information on what webhook actually changed, nor specifically whether it was created/updated/deleted, so this event is pretty useless unless you keep track of the webhooks in the channel manually beforehand.
- async fetch_channel_webhooks()[source]#
Perform an API call to fetch the webhooks for this channel.
- Returns:
typing.Sequence
[hikari.webhooks.PartialWebhook
]The webhooks in this channel.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.ForbiddenError
If you are missing the
MANAGE_WEBHOOKS
permission.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.InternalServerError
If an internal error occurs on Discord while handling the request.
- async fetch_guild_webhooks()[source]#
Perform an API call to fetch the webhooks for this guild.
- Returns:
typing.Sequence
[hikari.webhooks.PartialWebhook
]The webhooks in this guild.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.ForbiddenError
If you are missing the
MANAGE_WEBHOOKS
permission.hikari.errors.NotFoundError
If the guild 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.