Skip to content

hikari.events.guild_events#

Events that fire when something occurs within a guild.

AuditLogEntryCreateEvent #

Bases: GuildEvent

Event sent when a guild audit log entry was created.

app property #

app: RESTAware

App instance for this application.

entry class-attribute instance-attribute #

entry: AuditLogEntry = field()

The created entry.

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.

BanCreateEvent #

Bases: BanEvent

Event that is fired when a user is banned from a guild.

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.

user class-attribute instance-attribute #

user: User = field()

User that this ban event affects.

fetch_ban async #

fetch_ban() -> GuildBan

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

This will include the optionally defined audit log reason for the ban.

RETURNS DESCRIPTION
GuildBan

The ban details.

BanDeleteEvent #

Bases: BanEvent

Event that is fired when a user is unbanned from a guild.

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.

user class-attribute instance-attribute #

user: User = field()

User that this ban event affects.

BanEvent #

Bases: GuildEvent, ABC

Event base for any guild ban or unban.

app property #

app: RESTAware

App instance for this application.

user abstractmethod property #

user: User

User that this ban event affects.

user_id property #

user_id: Snowflake

User ID of the user that got banned.

fetch_user async #

fetch_user() -> User

Perform an API call to fetch the user this ban event affects.

RETURNS DESCRIPTION
User

The user affected by this event.

EmojisUpdateEvent #

Bases: GuildEvent

Event that is fired when the emojis in a guild are updated.

app class-attribute instance-attribute #

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

App instance for this application.

emojis class-attribute instance-attribute #

Sequence of all emojis in this guild.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event relates to.

old_emojis class-attribute instance-attribute #

Sequence of all old emojis in this guild.

This will be None if it's missing from the cache.

shard class-attribute instance-attribute #

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

Shard that received this event.

fetch_emojis async #

fetch_emojis() -> Sequence[KnownCustomEmoji]

Perform an API call to retrieve an up-to-date view of the emojis.

RETURNS DESCRIPTION
Sequence[KnownCustomEmoji]

All emojis in the guild.

GuildAvailableEvent #

Bases: GuildVisibilityEvent

Event fired when a guild becomes available.

This will occur on startup or after outages.

Note

Some fields like members and presences are included here but not on the other hikari.events.guild_events.GuildUpdateEvent and hikari.events.guild_events.GuildUnavailableEvent guild visibility event models.

app property #

app: RESTAware

App instance for this application.

channels class-attribute instance-attribute #

channels: Mapping[Snowflake, PermissibleGuildChannel] = field(repr=False)

Mapping of channel IDs to the channels in the guild.

chunk_nonce class-attribute instance-attribute #

chunk_nonce: Optional[str] = field(repr=False, default=None)

Nonce used to request the member chunks for this guild.

This will be None if no chunks were requested.

Note

This is a synthetic field.

emojis class-attribute instance-attribute #

emojis: Mapping[Snowflake, KnownCustomEmoji] = field(repr=False)

Mapping of emoji IDs to the emojis in the guild.

guild class-attribute instance-attribute #

guild: GatewayGuild = field()

Guild that just became available.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

members class-attribute instance-attribute #

members: Mapping[Snowflake, Member] = field(repr=False)

Mapping of user IDs to the members in the guild.

presences class-attribute instance-attribute #

presences: Mapping[Snowflake, MemberPresence] = field(repr=False)

Mapping of user IDs to the presences for the guild.

roles class-attribute instance-attribute #

roles: Mapping[Snowflake, Role] = field(repr=False)

Mapping of role IDs to the roles in the guild.

shard class-attribute instance-attribute #

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

Shard that received this event.

stickers class-attribute instance-attribute #

stickers: Mapping[Snowflake, GuildSticker] = field(repr=False)

Mapping of sticker IDs to the stickers in the guild.

threads class-attribute instance-attribute #

threads: Mapping[Snowflake, GuildThreadChannel] = field(repr=False)

Mapping of channel IDs to the threads in the guild.

voice_states class-attribute instance-attribute #

voice_states: Mapping[Snowflake, VoiceState] = field(repr=False)

Mapping of user IDs to the voice states active in this guild.

GuildEvent #

Bases: ShardEvent, ABC

Event base for any guild-bound event.

guild_id abstractmethod property #

guild_id: Snowflake

ID of the guild that this event relates to.

fetch_guild async #

fetch_guild() -> RESTGuild

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

RETURNS DESCRIPTION
RESTGuild

The guild this event occurred in.

fetch_guild_preview async #

fetch_guild_preview() -> GuildPreview

Perform an API call to get the preview of the event's guild.

RETURNS DESCRIPTION
GuildPreview

The preview of the guild this event occurred in.

get_guild #

get_guild() -> Optional[GatewayGuild]

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

If not known, this will return None instead.

RETURNS DESCRIPTION
Optional[GatewayGuild]

The guild this event relates to, or None if not known.

GuildJoinEvent #

Bases: GuildVisibilityEvent

Event fired when the bot joins a new guild.

Note

Some fields like members and presences are included here but not on the other hikari.events.guild_events.GuildUpdateEvent and hikari.events.guild_events.GuildUnavailableEvent guild visibility event models.

app property #

app: RESTAware

App instance for this application.

channels class-attribute instance-attribute #

channels: Mapping[Snowflake, PermissibleGuildChannel] = field(repr=False)

Mapping of channel IDs to the channels in the guild.

chunk_nonce class-attribute instance-attribute #

chunk_nonce: Optional[str] = field(repr=False, default=None)

Nonce used to request the member chunks for this guild.

This will be None if no chunks were requested.

Note

This is a synthetic field.

emojis class-attribute instance-attribute #

emojis: Mapping[Snowflake, KnownCustomEmoji] = field(repr=False)

Mapping of emoji IDs to the emojis in the guild.

guild class-attribute instance-attribute #

guild: GatewayGuild = field()

The guild the bot just joined.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

members class-attribute instance-attribute #

members: Mapping[Snowflake, Member] = field(repr=False)

Mapping of user IDs to the members in the guild.

presences class-attribute instance-attribute #

presences: Mapping[Snowflake, MemberPresence] = field(repr=False)

Mapping of user IDs to the presences for the guild.

roles class-attribute instance-attribute #

roles: Mapping[Snowflake, Role] = field(repr=False)

Mapping of role IDs to the roles in the guild.

shard class-attribute instance-attribute #

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

Shard that received this event.

stickers class-attribute instance-attribute #

stickers: Mapping[Snowflake, GuildSticker] = field(repr=False)

Mapping of sticker IDs to the stickers in the guild.

threads class-attribute instance-attribute #

threads: Mapping[Snowflake, GuildThreadChannel] = field(repr=False)

Mapping of channel IDs to the threads in the guild.

voice_states class-attribute instance-attribute #

voice_states: Mapping[Snowflake, VoiceState] = field(repr=False)

Mapping of user IDs to the voice states active in this guild.

GuildLeaveEvent #

Bases: GuildVisibilityEvent

Event fired when the bot is banned/kicked/leaves a guild.

This will also fire if the guild was 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 that this event relates to.

old_guild class-attribute instance-attribute #

old_guild: Optional[GatewayGuild] = field()

The old guild object.

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

shard class-attribute instance-attribute #

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

Shard that received this event.

fetch_guild async #

fetch_guild() -> NoReturn

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

RETURNS DESCRIPTION
RESTGuild

The guild this event occurred in.

GuildUnavailableEvent #

Bases: GuildVisibilityEvent

Event fired when a guild becomes unavailable because of an outage.

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 that this event relates to.

shard class-attribute instance-attribute #

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

Shard that received this event.

GuildUpdateEvent #

Bases: GuildEvent

Event fired when an existing guild is updated.

app property #

app: RESTAware

App instance for this application.

emojis class-attribute instance-attribute #

emojis: Mapping[Snowflake, KnownCustomEmoji] = field(repr=False)

Mapping of emoji IDs to the emojis in the guild.

guild class-attribute instance-attribute #

guild: GatewayGuild = field()

Guild that was just updated.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

old_guild class-attribute instance-attribute #

old_guild: Optional[GatewayGuild] = field()

The old guild object.

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

roles class-attribute instance-attribute #

roles: Mapping[Snowflake, Role] = field(repr=False)

Mapping of role IDs to the roles in the guild.

shard class-attribute instance-attribute #

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

Shard that received this event.

stickers class-attribute instance-attribute #

stickers: Mapping[Snowflake, GuildSticker] = field(repr=False)

Mapping of sticker IDs to the stickers in the guild.

GuildVisibilityEvent #

Bases: GuildEvent, ABC

Event base for any event that changes the visibility of a guild.

This includes when a guild becomes available after an outage, when a guild becomes available on startup, when a guild becomes unavailable due to an outage, when the user is kicked/banned/leaves a guild, or when the user joins a new guild.

IntegrationCreateEvent #

Bases: IntegrationEvent

Event that is fired when an integration is created in a guild.

app class-attribute instance-attribute #

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

App instance for this application.

application_id property #

application_id: Optional[Snowflake]

ID of Discord bot application this integration is connected to.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

id property #

ID of the integration.

integration class-attribute instance-attribute #

integration: Integration = field()

Integration that was created.

shard class-attribute instance-attribute #

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

Shard that received this event.

IntegrationDeleteEvent #

Bases: IntegrationEvent

Event that is fired when an integration is deleted in a guild.

app class-attribute instance-attribute #

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

App instance for this application.

application_id class-attribute instance-attribute #

application_id: Optional[Snowflake] = field()

ID of Discord bot application this integration is connected to.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event relates to.

id class-attribute instance-attribute #

id: Snowflake = field()

ID of the integration.

shard class-attribute instance-attribute #

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

Shard that received this event.

IntegrationEvent #

Bases: GuildEvent, ABC

Event base for any integration related events.

application_id abstractmethod property #

application_id: Optional[Snowflake]

ID of Discord bot application this integration is connected to.

id abstractmethod property #

ID of the integration.

fetch_integrations async #

fetch_integrations() -> Sequence[Integration]

Perform an API call to fetch some number of guild integrations.

Warning

The results of this are not clearly defined by Discord. The current behaviour appears to be that only the first 50 integrations actually get returned. Discord have made it clear that they are not willing to fix this in https://github.com/discord/discord-api-docs/issues/1990.

RETURNS DESCRIPTION
Sequence[Integration]

Some possibly random subset of the integrations in a guild, probably.

IntegrationUpdateEvent #

Bases: IntegrationEvent

Event that is fired when an integration is updated in a guild.

app class-attribute instance-attribute #

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

App instance for this application.

application_id property #

application_id: Optional[Snowflake]

ID of Discord bot application this integration is connected to.

guild_id property #

guild_id: Snowflake

ID of the guild that this event relates to.

id property #

ID of the integration.

integration class-attribute instance-attribute #

integration: Integration = field()

Integration that was updated.

shard class-attribute instance-attribute #

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

Shard that received this event.

PresenceUpdateEvent #

Bases: ShardEvent

Event fired when a user in a guild updates their presence in a guild.

Sent when a guild member changes their presence in a specific guild.

If the user is changed (e.g. new username), then this may fire many times (once for every guild the bot is part of). This is a limitation of how Discord implements their event system, unfortunately.

Furthermore, if the target user is a bot and the bot only updates their presence on specific shards, this will only fire for the corresponding shards that saw the presence update.

app property #

app: RESTAware

App instance for this application.

guild_id property #

guild_id: Snowflake

Guild ID that the presence was updated in.

old_presence class-attribute instance-attribute #

old_presence: Optional[MemberPresence] = field()

The old member presence object.

This will be None if the member presence missing from the cache.

presence class-attribute instance-attribute #

presence: MemberPresence = field()

Member presence.

shard class-attribute instance-attribute #

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

Shard that received this event.

user class-attribute instance-attribute #

User that was updated.

This is a partial user object that only contains the fields that were updated on the user profile.

Will be None if the user itself did not change. This is always the case if the user only updated their member representation and did not change their user profile directly.

user_id property #

user_id: Snowflake

User ID of the user that updated their presence.

fetch_user async #

fetch_user() -> User

Perform an API call to fetch the user this event concerns.

RETURNS DESCRIPTION
User

The user affected by this event.

get_user #

get_user() -> Optional[User]

Get the full cached user, if it is available.

RETURNS DESCRIPTION
Optional[User]

The full cached user, or None if not cached.

StickersUpdateEvent #

Bases: GuildEvent

Event that is fired when the emojis in a guild are updated.

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 that this event relates to.

old_stickers class-attribute instance-attribute #

old_stickers: Optional[Sequence[GuildSticker]] = field()

Sequence of all old stickers in this guild.

This will be None if it's missing from the cache.

shard class-attribute instance-attribute #

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

Shard that received this event.

stickers class-attribute instance-attribute #

stickers: Sequence[GuildSticker] = field()

Sequence of all stickers in this guild.

fetch_stickers async #

fetch_stickers() -> Sequence[GuildSticker]

Perform an API call to retrieve an up-to-date view of the emojis.

RETURNS DESCRIPTION
Sequence[GuildSticker]

All emojis in the guild.