Skip to content

hikari.events.channel_events#

Events that fire when channels are modified.

This does not include message events, nor reaction events.

ChannelEvent #

Bases: ShardEvent, ABC

Event base for any channel-bound event in guilds or private messages.

channel_id abstractmethod property #

channel_id: Snowflake

ID of the channel the event relates to.

fetch_channel abstractmethod async #

fetch_channel() -> PartialChannel

Perform an API call to fetch the details about this channel.

Note

For hikari.events.channel_events.GuildChannelDeleteEvent events, this will always raise an exception, since the channel will have already been removed.

RETURNS DESCRIPTION
PartialChannel

A derivative of hikari.channels.PartialChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

DMChannelEvent #

Bases: ChannelEvent, ABC

Event base for any channel-bound event in private messages.

fetch_channel async #

fetch_channel() -> PrivateChannel

Perform an API call to fetch the details about this channel.

Note

For hikari.events.channel_events.GuildChannelDeleteEvent events, this will always raise an exception, since the channel will have already been removed.

RETURNS DESCRIPTION
PrivateChannel

A derivative of hikari.channels.PrivateChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

DMPinsUpdateEvent #

Bases: PinsUpdateEvent, DMChannelEvent

Event fired when a message is pinned/unpinned in a private channel.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel the event relates to.

last_pin_timestamp class-attribute instance-attribute #

last_pin_timestamp: Optional[datetime] = field(repr=True)

Datetime of when the most recent message was pinned in the channel.

Will be None if nothing is pinned or the information is unavailable.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

fetch_channel async #

fetch_channel() -> DMChannel

Perform an API call to fetch the details about this channel.

RETURNS DESCRIPTION
DMChannel

A derivative of hikari.channels.DMChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

GuildChannelCreateEvent #

Bases: GuildChannelEvent

Event fired when a guild channel is created.

app property #

app: RESTAware

App instance for this application.

channel class-attribute instance-attribute #

channel: PermissibleGuildChannel = field(repr=True)

Guild channel that this event represents.

channel_id property #

channel_id: Snowflake

ID of the channel the event relates to.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

GuildChannelDeleteEvent #

Bases: GuildChannelEvent

Event fired when a guild channel is deleted.

app property #

app: RESTAware

App instance for this application.

channel class-attribute instance-attribute #

channel: PermissibleGuildChannel = field(repr=True)

Guild channel that this event represents.

channel_id property #

channel_id: Snowflake

ID of the channel the event relates to.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

fetch_channel async #

fetch_channel() -> NoReturn

Perform an API call to fetch the details about this channel.

Note

For hikari.events.channel_events.GuildChannelDeleteEvent events, this will always raise an exception, since the channel will have already been removed.

RETURNS DESCRIPTION
GuildChannel

A derivative of hikari.channels.GuildChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

GuildChannelEvent #

Bases: ChannelEvent, ABC

Event base for any channel-bound event in guilds.

guild_id abstractmethod property #

guild_id: Snowflake

ID of the guild that this event relates to.

fetch_channel async #

fetch_channel() -> GuildChannel

Perform an API call to fetch the details about this channel.

Note

For hikari.events.channel_events.GuildChannelDeleteEvent events, this will always raise an exception, since the channel will have already been removed.

RETURNS DESCRIPTION
GuildChannel

A derivative of hikari.channels.GuildChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_guild async #

fetch_guild() -> RESTGuild

Perform an API call to fetch the guild that this event relates to.

RETURNS DESCRIPTION
RESTGuild

The guild that this event occurred in.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are not part of the guild.

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

get_channel #

Get the cached channel that this event relates to, if known.

If not, return None.

RETURNS DESCRIPTION
Optional[GuildChannel]

The cached channel this event relates to. If not known, this will return None instead.

get_guild #

get_guild() -> Optional[GatewayGuild]

Get the cached guild that this event relates to, if known.

If not, return None.

RETURNS DESCRIPTION
Optional[GatewayGuild]

The gateway guild this event relates to, if known. Otherwise this will return None.

GuildChannelUpdateEvent #

Bases: GuildChannelEvent

Event fired when a guild channel is edited.

app property #

app: RESTAware

App instance for this application.

channel class-attribute instance-attribute #

channel: PermissibleGuildChannel = field(repr=True)

Guild channel that this event represents.

channel_id property #

channel_id: Snowflake

ID of the channel the event relates to.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

old_channel class-attribute instance-attribute #

old_channel: Optional[PermissibleGuildChannel] = field(repr=True)

The old guild channel object.

This will be None if the channel missing from the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

GuildPinsUpdateEvent #

Bases: PinsUpdateEvent, GuildChannelEvent

Event fired when a message is pinned/unpinned in a guild channel.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel the event relates to.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event relates to.

last_pin_timestamp class-attribute instance-attribute #

last_pin_timestamp: Optional[datetime] = field(repr=True)

Datetime of when the most recent message was pinned in the channel.

Will be None if nothing is pinned or the information is unavailable.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

fetch_channel async #

fetch_channel() -> TextableGuildChannel

Perform an API call to fetch the details about this channel.

RETURNS DESCRIPTION
TextableGuildChannel

A derivative of hikari.channels.TextableGuildChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

get_channel #

Get the cached channel that this event relates to, if known.

If not, return None.

RETURNS DESCRIPTION
Optional[TextableGuildChannel]

The cached channel this event relates to. If not known, this will return None instead.

GuildThreadAccessEvent #

Bases: GuildThreadEvent

Event fired when you're given access to an existing private thread.

app property #

app: RESTAware

App instance for this application.

guild_id property #

guild_id: Snowflake

ID of the guild this event is for.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

thread class-attribute instance-attribute #

The thread that you've been given access to.

thread_id property #

thread_id: Snowflake

ID of the thread this event is for.

GuildThreadCreateEvent #

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.

app property #

app: RESTAware

App instance for this application.

guild_id property #

guild_id: Snowflake

ID of the guild this event is for.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

thread class-attribute instance-attribute #

The thread that was created.

thread_id property #

thread_id: Snowflake

ID of the thread this event is for.

GuildThreadDeleteEvent #

Bases: GuildThreadEvent

Event fired when a thread is deleted.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild this event is for.

parent_id class-attribute instance-attribute #

parent_id: Snowflake = field()

The ID of the channel that the thread was deleted from.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

thread_id class-attribute instance-attribute #

thread_id: Snowflake = field()

ID of the thread this event is for.

type class-attribute instance-attribute #

type: ChannelType = field()

The type of thread that was deleted.

GuildThreadEvent #

Bases: ShardEvent, ABC

Event base for any event that is related to a guild thread.

guild_id abstractmethod property #

guild_id: Snowflake

ID of the guild this event is for.

thread_id abstractmethod property #

thread_id: Snowflake

ID of the thread this event is for.

fetch_channel async #

fetch_channel() -> GuildThreadChannel

Perform an API call to fetch the details about this thread.

Note

For hikari.events.channel_events.GuildThreadDeleteEvent events, this will always raise an exception, since the channel will have already been removed.

RETURNS DESCRIPTION
GuildThreadChannel

A derivative of hikari.channels.GuildThreadChannel. The actual type will vary depending on the type of channel this event concerns.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

GuildThreadUpdateEvent #

Bases: GuildThreadEvent

Event fired when a thread is updated.

app property #

app: RESTAware

App instance for this application.

guild_id property #

guild_id: Snowflake

ID of the guild this event is for.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

thread class-attribute instance-attribute #

The thread that was updated.

thread_id property #

thread_id: Snowflake

ID of the thread this event is for.

InviteCreateEvent #

Bases: InviteEvent

Event fired when an invite is created in a channel.

app property #

app: RESTAware

App instance for this application.

channel_id property #

channel_id: Snowflake

ID of the channel the event relates to.

code property #

code: str

Code that is used in the URL for the invite.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

invite class-attribute instance-attribute #

Invite that was created.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

InviteDeleteEvent #

Bases: InviteEvent

Event fired when an invite is deleted from a channel.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel the event relates to.

code class-attribute instance-attribute #

code: str = field()

Code that is used in the URL for the invite.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event relates to.

old_invite class-attribute instance-attribute #

Object of the old cached invite.

This will be None if the invite is missing from the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

fetch_invite async #

fetch_invite() -> NoReturn

Perform an API call to retrieve an up-to-date image of this invite.

RETURNS DESCRIPTION
Invite

The invite object.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the invite is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

InviteEvent #

Bases: GuildChannelEvent, ABC

Base event type for guild invite updates.

code abstractmethod property #

code: str

Code that is used in the URL for the invite.

fetch_invite async #

fetch_invite() -> Invite

Perform an API call to retrieve an up-to-date image of this invite.

RETURNS DESCRIPTION
Invite

The invite object.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the invite is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PinsUpdateEvent #

Bases: ChannelEvent, ABC

Base event fired when a message is pinned/unpinned in a channel.

last_pin_timestamp abstractmethod property #

last_pin_timestamp: Optional[datetime]

Datetime of when the most recent message was pinned in the channel.

Will be None if nothing is pinned or the information is unavailable.

fetch_channel abstractmethod async #

fetch_channel() -> TextableChannel

Perform an API call to fetch the details about this channel.

RETURNS DESCRIPTION
TextableChannel

A derivative of hikari.channels.TextableChannel. The actual type will vary depending on the type of channel this event concerns.

fetch_pins async #

fetch_pins() -> Sequence[Message]

Perform an API call to fetch the pinned messages in this channel.

RETURNS DESCRIPTION
Sequence[Message]

The pinned messages in this channel.

ThreadListSyncEvent #

Bases: ShardEvent

Event fired to sync threads when the bot gains access to one or more channels.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_ids class-attribute instance-attribute #

channel_ids: Optional[Sequence[Snowflake]] = field()

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.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

threads class-attribute instance-attribute #

Mapping of IDs to objects of the active threads in the given channels.

ThreadMembersUpdateEvent #

Bases: GuildThreadEvent

Event fired when a thread's members are updated.

added_members class-attribute instance-attribute #

added_members: Mapping[Snowflake, ThreadMember] = field()

Mapping of IDs to objects of the members which were added to the thread.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

approximate_member_count class-attribute instance-attribute #

approximate_member_count: int = field(eq=False, hash=False, repr=True)

Approximate count of members in the thread channel.

Warning

This stops counting at 50 for threads created before 2022/06/01.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild this event is for.

guild_members class-attribute instance-attribute #

guild_members: Mapping[Snowflake, Member] = field()

Mapping of IDs to guild member objects of the added thread members.

Will only be filled if the hikari.intents.Intents.GUILD_MEMBERS intent is declared.

guild_presences class-attribute instance-attribute #

guild_presences: Mapping[Snowflake, MemberPresence] = field()

Mapping of IDs to guild presence objects of the added members.

Will only be filled if the hikari.intents.Intents.GUILD_PRESENCES intent is declared.

removed_member_ids class-attribute instance-attribute #

removed_member_ids: Sequence[Snowflake] = field()

Sequence of IDs of users which were removed from the thread.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

thread_id class-attribute instance-attribute #

thread_id: Snowflake = field()

ID of the thread this event is for.

WebhookUpdateEvent #

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.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel the event relates to.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event relates to.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

fetch_channel_webhooks async #

fetch_channel_webhooks() -> Sequence[PartialWebhook]

Perform an API call to fetch the webhooks for this channel.

RETURNS DESCRIPTION
Sequence[PartialWebhook]

The webhooks in this channel.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_guild_webhooks async #

fetch_guild_webhooks() -> Sequence[PartialWebhook]

Perform an API call to fetch the webhooks for this guild.

RETURNS DESCRIPTION
Sequence[PartialWebhook]

The webhooks in this guild.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission.

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.