hikari.events.guild_events#
Events that fire when something occurs within a guild.
Module Contents#
- class hikari.events.guild_events.GuildEvent[source]#
Bases:
hikari.events.shard_events.ShardEvent
,abc.ABC
Event base for any guild-bound event.
- abstract property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- async fetch_guild()[source]#
Perform an API call to get the guild that this event relates to.
- Returns
hikari.guilds.RESTGuild
The guild this event occurred in.
- async fetch_guild_preview()[source]#
Perform an API call to get the preview of the event’s guild.
- Returns
hikari.guilds.GuildPreview
The preview of the guild this event occurred in.
- get_guild()[source]#
Get the cached guild that this event relates to, if known.
If not known, this will return
None
instead.- Returns
typing.Optional
[hikari.guilds.GatewayGuild
]The guild this event relates to, or
None
if not known.
- class hikari.events.guild_events.GuildVisibilityEvent[source]#
Bases:
GuildEvent
,abc.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.
- class hikari.events.guild_events.GuildAvailableEvent[source]#
Bases:
GuildVisibilityEvent
Event fired when a guild becomes available.
This will occur on startup or after outages.
Note
Some fields like
members
andpresences
are included here but not on the otherGuildUpdateEvent
andGuildUnavailableEvent
guild visibility event models.- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- guild: hikari.guilds.GatewayGuild[source]#
Guild that just became available.
- emojis: Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji][source]#
Mapping of emoji IDs to the emojis in the guild.
- stickers: Mapping[hikari.snowflakes.Snowflake, hikari.stickers.GuildSticker][source]#
Mapping of sticker IDs to the stickers in the guild.
- roles: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Role][source]#
Mapping of role IDs to the roles in the guild.
- channels: Mapping[hikari.snowflakes.Snowflake, hikari.channels.PermissibleGuildChannel][source]#
Mapping of channel IDs to the channels in the guild.
- threads: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildThreadChannel][source]#
Mapping of channel IDs to the threads in the guild.
- members: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Member][source]#
Mapping of user IDs to the members in the guild.
- presences: Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence][source]#
Mapping of user IDs to the presences for the guild.
- voice_states: Mapping[hikari.snowflakes.Snowflake, hikari.voices.VoiceState][source]#
Mapping of user IDs to the voice states active in this guild.
- class hikari.events.guild_events.GuildJoinEvent[source]#
Bases:
GuildVisibilityEvent
Event fired when the bot joins a new guild.
Note
Some fields like
members
andpresences
are included here but not on the otherGuildUpdateEvent
andGuildUnavailableEvent
guild visibility event models.- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- guild: hikari.guilds.GatewayGuild[source]#
The guild the bot just joined.
- emojis: Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji][source]#
Mapping of emoji IDs to the emojis in the guild.
- stickers: Mapping[hikari.snowflakes.Snowflake, hikari.stickers.GuildSticker][source]#
Mapping of sticker IDs to the stickers in the guild.
- roles: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Role][source]#
Mapping of role IDs to the roles in the guild.
- channels: Mapping[hikari.snowflakes.Snowflake, hikari.channels.PermissibleGuildChannel][source]#
Mapping of channel IDs to the channels in the guild.
- threads: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildThreadChannel][source]#
Mapping of channel IDs to the threads in the guild.
- members: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Member][source]#
Mapping of user IDs to the members in the guild.
- presences: Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence][source]#
Mapping of user IDs to the presences for the guild.
- voice_states: Mapping[hikari.snowflakes.Snowflake, hikari.voices.VoiceState][source]#
Mapping of user IDs to the voice states active in this guild.
- class hikari.events.guild_events.GuildLeaveEvent[source]#
Bases:
GuildVisibilityEvent
Event fired when the bot is banned/kicked/leaves a guild.
This will also fire if the guild was deleted.
- old_guild: Optional[hikari.guilds.GatewayGuild][source]#
The old guild object.
This will be
None
if the guild missing from the cache.
Bases:
GuildVisibilityEvent
Event fired when a guild becomes unavailable because of an outage.
- class hikari.events.guild_events.GuildUpdateEvent[source]#
Bases:
GuildEvent
Event fired when an existing guild is updated.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- old_guild: Optional[hikari.guilds.GatewayGuild][source]#
The old guild object.
This will be
None
if the guild missing from the cache.
- guild: hikari.guilds.GatewayGuild[source]#
Guild that was just updated.
- emojis: Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji][source]#
Mapping of emoji IDs to the emojis in the guild.
- stickers: Mapping[hikari.snowflakes.Snowflake, hikari.stickers.GuildSticker][source]#
Mapping of sticker IDs to the stickers in the guild.
- roles: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.Role][source]#
Mapping of role IDs to the roles in the guild.
- class hikari.events.guild_events.BanEvent[source]#
Bases:
GuildEvent
,abc.ABC
Event base for any guild ban or unban.
- abstract property user: hikari.users.User[source]#
User that this ban event affects.
- property user_id: hikari.snowflakes.Snowflake[source]#
User ID of the user that got banned.
- async fetch_user()[source]#
Perform an API call to fetch the user this ban event affects.
- Returns
hikari.users.User
The user affected by this event.
- class hikari.events.guild_events.BanCreateEvent[source]#
Bases:
BanEvent
Event that is fired when a user is banned from a guild.
- async fetch_ban()[source]#
Perform an API call to fetch the details about this ban.
This will include the optionally defined audit log reason for the ban.
- Returns
hikari.guilds.GuildBan
The ban details.
- class hikari.events.guild_events.BanDeleteEvent[source]#
Bases:
BanEvent
Event that is fired when a user is unbanned from a guild.
- class hikari.events.guild_events.EmojisUpdateEvent[source]#
Bases:
GuildEvent
Event that is fired when the emojis in a guild are updated.
- old_emojis: Optional[Sequence[hikari.emojis.KnownCustomEmoji]][source]#
Sequence of all old emojis in this guild.
This will be
None
if it’s missing from the cache.
- emojis: Sequence[hikari.emojis.KnownCustomEmoji][source]#
Sequence of all emojis in this guild.
- async fetch_emojis()[source]#
Perform an API call to retrieve an up-to-date view of the emojis.
- Returns
typing.Sequence
[hikari.emojis.KnownCustomEmoji
]All emojis in the guild.
- class hikari.events.guild_events.StickersUpdateEvent[source]#
Bases:
GuildEvent
Event that is fired when the emojis in a guild are updated.
- old_stickers: Optional[Sequence[hikari.stickers.GuildSticker]][source]#
Sequence of all old stickers in this guild.
This will be
None
if it’s missing from the cache.
- stickers: Sequence[hikari.stickers.GuildSticker][source]#
Sequence of all stickers in this guild.
- async fetch_stickers()[source]#
Perform an API call to retrieve an up-to-date view of the emojis.
- Returns
typing.Sequence
[hikari.stickers.GuildSticker
]All emojis in the guild.
- class hikari.events.guild_events.IntegrationEvent[source]#
Bases:
GuildEvent
,abc.ABC
Event base for any integration related events.
- abstract property application_id: Optional[hikari.snowflakes.Snowflake][source]#
ID of Discord bot application this integration is connected to.
- abstract property id: hikari.snowflakes.Snowflake[source]#
ID of the integration.
- async fetch_integrations()[source]#
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
typing.Sequence
[hikari.guilds.Integration
]Some possibly random subset of the integrations in a guild, probably.
- class hikari.events.guild_events.IntegrationCreateEvent[source]#
Bases:
IntegrationEvent
Event that is fired when an integration is created in a guild.
- property application_id: Optional[hikari.snowflakes.Snowflake][source]#
ID of Discord bot application this integration is connected to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- property id: hikari.snowflakes.Snowflake[source]#
ID of the integration.
- integration: hikari.guilds.Integration[source]#
Integration that was created.
- class hikari.events.guild_events.IntegrationDeleteEvent[source]#
Bases:
IntegrationEvent
Event that is fired when an integration is deleted in a guild.
- class hikari.events.guild_events.IntegrationUpdateEvent[source]#
Bases:
IntegrationEvent
Event that is fired when an integration is updated in a guild.
- property application_id: Optional[hikari.snowflakes.Snowflake][source]#
ID of Discord bot application this integration is connected to.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event relates to.
- property id: hikari.snowflakes.Snowflake[source]#
ID of the integration.
- integration: hikari.guilds.Integration[source]#
Integration that was updated.
- class hikari.events.guild_events.PresenceUpdateEvent[source]#
Bases:
hikari.events.shard_events.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.
- property user_id: hikari.snowflakes.Snowflake[source]#
User ID of the user that updated their presence.
- property guild_id: hikari.snowflakes.Snowflake[source]#
Guild ID that the presence was updated in.
- old_presence: Optional[hikari.presences.MemberPresence][source]#
The old member presence object.
This will be
None
if the member presence missing from the cache.
- presence: hikari.presences.MemberPresence[source]#
Member presence.
- user: Optional[hikari.users.PartialUser][source]#
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.
- get_user()[source]#
Get the full cached user, if it is available.
- Returns
typing.Optional
[hikari.users.User
]The full cached user, or
None
if not cached.
- async fetch_user()[source]#
Perform an API call to fetch the user this event concerns.
- Returns
hikari.users.User
The user affected by this event.