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.
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
#
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.
BanDeleteEvent #
Bases: BanEvent
Event that is fired when a user is unbanned from a guild.
guild_id class-attribute
instance-attribute
#
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.
BanEvent #
EmojisUpdateEvent #
Bases: GuildEvent
Event that is fired when the emojis in a guild are updated.
app class-attribute
instance-attribute
#
App instance for this application.
emojis class-attribute
instance-attribute
#
emojis: Sequence[KnownCustomEmoji] = field()
Sequence of all emojis in this guild.
guild_id class-attribute
instance-attribute
#
ID of the guild that this event relates to.
old_emojis class-attribute
instance-attribute
#
old_emojis: Optional[Sequence[KnownCustomEmoji]] = field()
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.
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
#
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.
members class-attribute
instance-attribute
#
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
#
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.
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 |
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.
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
#
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.
members class-attribute
instance-attribute
#
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
#
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 instance for this application.
guild_id class-attribute
instance-attribute
#
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.
GuildUnavailableEvent #
Bases: GuildVisibilityEvent
Event fired when a guild becomes unavailable because of an outage.
app class-attribute
instance-attribute
#
App instance for this application.
guild_id class-attribute
instance-attribute
#
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.
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.
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
#
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 instance for this application.
application_id property
#
ID of Discord bot application this integration is connected to.
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 instance for this application.
application_id class-attribute
instance-attribute
#
ID of Discord bot application this integration is connected to.
guild_id class-attribute
instance-attribute
#
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.
IntegrationEvent #
Bases: GuildEvent
, ABC
Event base for any integration related events.
application_id abstractmethod
property
#
ID of Discord bot application this integration is connected to.
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 instance for this application.
application_id property
#
ID of Discord bot application this integration is connected to.
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.
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.
shard class-attribute
instance-attribute
#
shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})
Shard that received this event.
user class-attribute
instance-attribute
#
user: Optional[PartialUser] = field()
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.
StickersUpdateEvent #
Bases: GuildEvent
Event that is fired when the emojis in a guild are updated.
app class-attribute
instance-attribute
#
App instance for this application.
guild_id class-attribute
instance-attribute
#
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. |