Skip to content

Discord

These are events dispatched by Discord. This is intended as a reference so you know what data to expect for each event.

Example Usage

To listen to an event, use the listen decorator:

1
2
3
4
5
6
from interactions import listen
from interactions.api.events import ChannelCreate  # or any other event

@listen(ChannelCreate)
async def an_event_handler(event: ChannelCreate):
    print(f"Channel created with name: {event.channel.name}")

For more information, including other ways to listen to events, see the events guide.

Warning

While all of these events are documented, not all of them are used, currently.

AutoModCreated

Bases: BaseEvent

Dispatched when an auto mod rule is created

Source code in interactions/api/events/discord.py
141
142
143
144
145
146
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class AutoModCreated(BaseEvent):
    """Dispatched when an auto mod rule is created"""

    guild: "Guild" = attrs.field(repr=False, metadata=docs("The guild the rule was modified in"))
    rule: "AutoModRule" = attrs.field(repr=False, metadata=docs("The rule that was modified"))

AutoModDeleted

Bases: AutoModCreated

Dispatched when an auto mod rule is deleted

Source code in interactions/api/events/discord.py
156
157
158
159
160
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class AutoModDeleted(AutoModCreated):
    """Dispatched when an auto mod rule is deleted"""

    ...

AutoModExec

Bases: BaseEvent

Dispatched when an auto modation action is executed

Source code in interactions/api/events/discord.py
132
133
134
135
136
137
138
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class AutoModExec(BaseEvent):
    """Dispatched when an auto modation action is executed"""

    execution: "AutoModerationAction" = attrs.field(repr=False, metadata=docs("The executed auto mod action"))
    channel: "TYPE_ALL_CHANNEL" = attrs.field(repr=False, metadata=docs("The channel the action was executed in"))
    guild: "Guild" = attrs.field(repr=False, metadata=docs("The guild the action was executed in"))

AutoModUpdated

Bases: AutoModCreated

Dispatched when an auto mod rule is modified

Source code in interactions/api/events/discord.py
149
150
151
152
153
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class AutoModUpdated(AutoModCreated):
    """Dispatched when an auto mod rule is modified"""

    ...

BanCreate

Bases: GuildEvent

Dispatched when someone was banned from a guild.

Source code in interactions/api/events/discord.py
338
339
340
341
342
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class BanCreate(GuildEvent):
    """Dispatched when someone was banned from a guild."""

    user: "BaseUser" = attrs.field(repr=False, metadata=docs("The user"))

BanRemove

Bases: BanCreate

Dispatched when a users ban is removed.

Source code in interactions/api/events/discord.py
345
346
347
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class BanRemove(BanCreate):
    """Dispatched when a users ban is removed."""

BaseMessagePollEvent

Bases: BaseEvent

Source code in interactions/api/events/discord.py
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class BaseMessagePollEvent(BaseEvent):
    user_id: "Snowflake_Type" = attrs.field(repr=False)
    """The ID of the user that voted"""
    channel_id: "Snowflake_Type" = attrs.field(repr=False)
    """The ID of the channel the poll is in"""
    message_id: "Snowflake_Type" = attrs.field(repr=False)
    """The ID of the message the poll is in"""
    answer_id: int = attrs.field(repr=False)
    """The ID of the answer the user voted for"""
    guild_id: "Optional[Snowflake_Type]" = attrs.field(repr=False, default=None)
    """The ID of the guild the poll is in"""

    def get_message(self) -> "Optional[Message]":
        """Get the message object if it is cached"""
        return self.client.cache.get_message(self.channel_id, self.message_id)

    def get_user(self) -> "Optional[User]":
        """Get the user object if it is cached"""
        return self.client.get_user(self.user_id)

    def get_channel(self) -> "Optional[TYPE_ALL_CHANNEL]":
        """Get the channel object if it is cached"""
        return self.client.get_channel(self.channel_id)

    def get_guild(self) -> "Optional[Guild]":
        """Get the guild object if it is cached"""
        return self.client.get_guild(self.guild_id) if self.guild_id is not None else None

    def get_poll(self) -> "Optional[Poll]":
        """Get the poll object if it is cached"""
        message = self.get_message()
        return message.poll if message is not None else None

    async def fetch_message(self) -> "Message":
        """Fetch the message the poll is in"""
        return await self.client.cache.fetch_message(self.channel_id, self.message_id)

    async def fetch_user(self) -> "User":
        """Fetch the user that voted"""
        return await self.client.fetch_user(self.user_id)

    async def fetch_channel(self) -> "TYPE_ALL_CHANNEL":
        """Fetch the channel the poll is in"""
        return await self.client.fetch_channel(self.channel_id)

    async def fetch_guild(self) -> "Optional[Guild]":
        """Fetch the guild the poll is in"""
        return await self.client.fetch_guild(self.guild_id) if self.guild_id is not None else None

    async def fetch_poll(self) -> "Poll":
        """Fetch the poll object"""
        message = await self.fetch_message()
        return message.poll

answer_id: int = attrs.field(repr=False) class-attribute

The ID of the answer the user voted for

channel_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the channel the poll is in

guild_id: Optional[Snowflake_Type] = attrs.field(repr=False, default=None) class-attribute

The ID of the guild the poll is in

message_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the message the poll is in

user_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the user that voted

fetch_channel() async

Fetch the channel the poll is in

Source code in interactions/api/events/discord.py
636
637
638
async def fetch_channel(self) -> "TYPE_ALL_CHANNEL":
    """Fetch the channel the poll is in"""
    return await self.client.fetch_channel(self.channel_id)

fetch_guild() async

Fetch the guild the poll is in

Source code in interactions/api/events/discord.py
640
641
642
async def fetch_guild(self) -> "Optional[Guild]":
    """Fetch the guild the poll is in"""
    return await self.client.fetch_guild(self.guild_id) if self.guild_id is not None else None

fetch_message() async

Fetch the message the poll is in

Source code in interactions/api/events/discord.py
628
629
630
async def fetch_message(self) -> "Message":
    """Fetch the message the poll is in"""
    return await self.client.cache.fetch_message(self.channel_id, self.message_id)

fetch_poll() async

Fetch the poll object

Source code in interactions/api/events/discord.py
644
645
646
647
async def fetch_poll(self) -> "Poll":
    """Fetch the poll object"""
    message = await self.fetch_message()
    return message.poll

fetch_user() async

Fetch the user that voted

Source code in interactions/api/events/discord.py
632
633
634
async def fetch_user(self) -> "User":
    """Fetch the user that voted"""
    return await self.client.fetch_user(self.user_id)

get_channel()

Get the channel object if it is cached

Source code in interactions/api/events/discord.py
615
616
617
def get_channel(self) -> "Optional[TYPE_ALL_CHANNEL]":
    """Get the channel object if it is cached"""
    return self.client.get_channel(self.channel_id)

get_guild()

Get the guild object if it is cached

Source code in interactions/api/events/discord.py
619
620
621
def get_guild(self) -> "Optional[Guild]":
    """Get the guild object if it is cached"""
    return self.client.get_guild(self.guild_id) if self.guild_id is not None else None

get_message()

Get the message object if it is cached

Source code in interactions/api/events/discord.py
607
608
609
def get_message(self) -> "Optional[Message]":
    """Get the message object if it is cached"""
    return self.client.cache.get_message(self.channel_id, self.message_id)

get_poll()

Get the poll object if it is cached

Source code in interactions/api/events/discord.py
623
624
625
626
def get_poll(self) -> "Optional[Poll]":
    """Get the poll object if it is cached"""
    message = self.get_message()
    return message.poll if message is not None else None

get_user()

Get the user object if it is cached

Source code in interactions/api/events/discord.py
611
612
613
def get_user(self) -> "Optional[User]":
    """Get the user object if it is cached"""
    return self.client.get_user(self.user_id)

BaseVoiceEvent

Bases: BaseEvent

Source code in interactions/api/events/discord.py
759
760
761
762
763
764
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class BaseVoiceEvent(BaseEvent):
    state: "VoiceState" = attrs.field(
        repr=False,
    )
    """The current voice state of the user"""

state: VoiceState = attrs.field(repr=False) class-attribute

The current voice state of the user

ChannelCreate

Bases: BaseEvent

Dispatched when a channel is created.

Source code in interactions/api/events/discord.py
177
178
179
180
181
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ChannelCreate(BaseEvent):
    """Dispatched when a channel is created."""

    channel: "TYPE_ALL_CHANNEL" = attrs.field(repr=False, metadata=docs("The channel this event is dispatched from"))

ChannelDelete

Bases: ChannelCreate

Dispatched when a channel is deleted.

Source code in interactions/api/events/discord.py
198
199
200
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ChannelDelete(ChannelCreate):
    """Dispatched when a channel is deleted."""

ChannelPinsUpdate

Bases: ChannelCreate

Dispatched when a channel's pins are updated.

Source code in interactions/api/events/discord.py
203
204
205
206
207
208
209
210
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ChannelPinsUpdate(ChannelCreate):
    """Dispatched when a channel's pins are updated."""

    last_pin_timestamp: "Timestamp" = attrs.field(
        repr=False,
    )
    """The time at which the most recent pinned message was pinned"""

last_pin_timestamp: Timestamp = attrs.field(repr=False) class-attribute

The time at which the most recent pinned message was pinned

ChannelUpdate

Bases: BaseEvent

Dispatched when a channel is updated.

Source code in interactions/api/events/discord.py
184
185
186
187
188
189
190
191
192
193
194
195
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ChannelUpdate(BaseEvent):
    """Dispatched when a channel is updated."""

    before: "TYPE_ALL_CHANNEL" = attrs.field(
        repr=False,
    )
    """Channel before this event. MISSING if it was not cached before"""
    after: "TYPE_ALL_CHANNEL" = attrs.field(
        repr=False,
    )
    """Channel after this event"""

after: TYPE_ALL_CHANNEL = attrs.field(repr=False) class-attribute

Channel after this event

before: TYPE_ALL_CHANNEL = attrs.field(repr=False) class-attribute

Channel before this event. MISSING if it was not cached before

EntitlementCreate

Bases: BaseEntitlementEvent

Dispatched when a user subscribes to a SKU.

Source code in interactions/api/events/discord.py
915
916
917
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class EntitlementCreate(BaseEntitlementEvent):
    """Dispatched when a user subscribes to a SKU."""

EntitlementDelete

Bases: BaseEntitlementEvent

Dispatched when a user's entitlement is deleted.

Notably, this event is not dispatched when a user's subscription is cancelled. Instead, you simply won't receive an EntitlementUpdate event for the next billing period.

Source code in interactions/api/events/discord.py
925
926
927
928
929
930
931
932
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class EntitlementDelete(BaseEntitlementEvent):
    """
    Dispatched when a user's entitlement is deleted.

    Notably, this event is not dispatched when a user's subscription is cancelled.
    Instead, you simply won't receive an EntitlementUpdate event for the next billing period.
    """

EntitlementUpdate

Bases: BaseEntitlementEvent

Dispatched when a user's subscription renews for the next billing period.

Source code in interactions/api/events/discord.py
920
921
922
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class EntitlementUpdate(BaseEntitlementEvent):
    """Dispatched when a user's subscription renews for the next billing period."""

GuildAuditLogEntryCreate

Bases: GuildEvent

Dispatched when audit log entry is created

Source code in interactions/api/events/discord.py
849
850
851
852
853
854
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildAuditLogEntryCreate(GuildEvent):
    """Dispatched when audit log entry is created"""

    audit_log_entry: interactions.models.AuditLogEntry = attrs.field(repr=False)
    """The audit log entry object"""

audit_log_entry: interactions.models.AuditLogEntry = attrs.field(repr=False) class-attribute

The audit log entry object

GuildAvailable

Bases: GuildEvent

Dispatched when a guild becomes available.

Source code in interactions/api/events/discord.py
328
329
330
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildAvailable(GuildEvent):
    """Dispatched when a guild becomes available."""

GuildEmojisUpdate

Bases: GuildEvent

Dispatched when a guild's emojis are updated.

Source code in interactions/api/events/discord.py
350
351
352
353
354
355
356
357
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildEmojisUpdate(GuildEvent):
    """Dispatched when a guild's emojis are updated."""

    before: List["CustomEmoji"] = attrs.field(repr=False, factory=list)
    """List of emoji before this event. Only includes emojis that were cached. To enable the emoji cache (and this field), start your bot with `Client(enable_emoji_cache=True)`"""
    after: List["CustomEmoji"] = attrs.field(repr=False, factory=list)
    """List of emoji after this event"""

after: List[CustomEmoji] = attrs.field(repr=False, factory=list) class-attribute

List of emoji after this event

before: List[CustomEmoji] = attrs.field(repr=False, factory=list) class-attribute

List of emoji before this event. Only includes emojis that were cached. To enable the emoji cache (and this field), start your bot with Client(enable_emoji_cache=True)

GuildJoin

Bases: GuildEvent

Dispatched when a guild is joined, created, or becomes available.

Note

This is called multiple times during startup, check the bot is ready before responding to this.

Source code in interactions/api/events/discord.py
292
293
294
295
296
297
298
299
300
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildJoin(GuildEvent):
    """
    Dispatched when a guild is joined, created, or becomes available.

    !!! note
        This is called multiple times during startup, check the bot is ready before responding to this.

    """

GuildLeft

Bases: BaseEvent

Dispatched when a guild is left.

Source code in interactions/api/events/discord.py
317
318
319
320
321
322
323
324
325
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildLeft(BaseEvent):
    """Dispatched when a guild is left."""

    guild_id: "Snowflake_Type" = attrs.field(repr=True, converter=to_snowflake)
    """The ID of the guild"""

    guild: "Guild" = attrs.field(repr=True)
    """The guild this event is dispatched from"""

guild: Guild = attrs.field(repr=True) class-attribute

The guild this event is dispatched from

guild_id: Snowflake_Type = attrs.field(repr=True, converter=to_snowflake) class-attribute

The ID of the guild

GuildMembersChunk

Bases: GuildEvent

Sent in response to Guild Request Members.

You can use the chunk_index and chunk_count to calculate how many chunks are left for your request.

Source code in interactions/api/events/discord.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildMembersChunk(GuildEvent):
    """
    Sent in response to Guild Request Members.

    You can use the `chunk_index` and `chunk_count` to calculate how
    many chunks are left for your request.

    """

    chunk_index: int = attrs.field(
        repr=False,
    )
    """The chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)"""
    chunk_count: int = attrs.field(
        repr=False,
    )
    """the total number of expected chunks for this response"""
    presences: List = attrs.field(
        repr=False,
    )
    """if passing true to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here"""
    nonce: str = attrs.field(
        repr=False,
    )
    """The nonce used in the request, if any"""
    members: List["Member"] = attrs.field(repr=False, factory=list)
    """A list of members"""

chunk_count: int = attrs.field(repr=False) class-attribute

the total number of expected chunks for this response

chunk_index: int = attrs.field(repr=False) class-attribute

The chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)

members: List[Member] = attrs.field(repr=False, factory=list) class-attribute

A list of members

nonce: str = attrs.field(repr=False) class-attribute

The nonce used in the request, if any

presences: List = attrs.field(repr=False) class-attribute

if passing true to REQUEST_GUILD_MEMBERS, presences of the returned members will be here

GuildScheduledEventCreate

Bases: BaseEvent

Dispatched when scheduled event is created

Source code in interactions/api/events/discord.py
857
858
859
860
861
862
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildScheduledEventCreate(BaseEvent):
    """Dispatched when scheduled event is created"""

    scheduled_event: "ScheduledEvent" = attrs.field(repr=True)
    """The scheduled event object"""

scheduled_event: ScheduledEvent = attrs.field(repr=True) class-attribute

The scheduled event object

GuildScheduledEventDelete

Bases: GuildScheduledEventCreate

Dispatched when scheduled event is deleted

Source code in interactions/api/events/discord.py
875
876
877
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildScheduledEventDelete(GuildScheduledEventCreate):
    """Dispatched when scheduled event is deleted"""

GuildScheduledEventUpdate

Bases: BaseEvent

Dispatched when scheduled event is updated

Source code in interactions/api/events/discord.py
865
866
867
868
869
870
871
872
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildScheduledEventUpdate(BaseEvent):
    """Dispatched when scheduled event is updated"""

    before: Absent["ScheduledEvent"] = attrs.field(repr=True)
    """The scheduled event before this event was created"""
    after: "ScheduledEvent" = attrs.field(repr=True)
    """The scheduled event after this event was created"""

after: ScheduledEvent = attrs.field(repr=True) class-attribute

The scheduled event after this event was created

before: Absent[ScheduledEvent] = attrs.field(repr=True) class-attribute

The scheduled event before this event was created

GuildScheduledEventUserAdd

Bases: GuildEvent

Dispatched when scheduled event is created

Source code in interactions/api/events/discord.py
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildScheduledEventUserAdd(GuildEvent):
    """Dispatched when scheduled event is created"""

    scheduled_event_id: "Snowflake_Type" = attrs.field(repr=True)
    """The ID of the scheduled event"""
    user_id: "Snowflake_Type" = attrs.field(repr=True)
    """The ID of the user that has been added/removed from scheduled event"""

    @property
    def scheduled_event(self) -> Optional["ScheduledEvent"]:
        """The scheduled event object if cached"""
        return self.client.get_scheduled_event(self.scheduled_event_id)

    @property
    def user(self) -> Optional["User"]:
        """The user that has been added/removed from scheduled event if cached"""
        return self.client.get_user(self.user_id)

    @property
    def member(self) -> Optional["Member"]:
        """The guild member that has been added/removed from scheduled event if cached"""
        return self.client.get_member(self.guild_id, self.user.id)

member: Optional[Member] property

The guild member that has been added/removed from scheduled event if cached

scheduled_event: Optional[ScheduledEvent] property

The scheduled event object if cached

scheduled_event_id: Snowflake_Type = attrs.field(repr=True) class-attribute

The ID of the scheduled event

user: Optional[User] property

The user that has been added/removed from scheduled event if cached

user_id: Snowflake_Type = attrs.field(repr=True) class-attribute

The ID of the user that has been added/removed from scheduled event

GuildScheduledEventUserRemove

Bases: GuildScheduledEventUserAdd

Dispatched when scheduled event is removed

Source code in interactions/api/events/discord.py
905
906
907
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildScheduledEventUserRemove(GuildScheduledEventUserAdd):
    """Dispatched when scheduled event is removed"""

GuildStickersUpdate

Bases: GuildEvent

Dispatched when a guild's stickers are updated.

Source code in interactions/api/events/discord.py
360
361
362
363
364
365
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildStickersUpdate(GuildEvent):
    """Dispatched when a guild's stickers are updated."""

    stickers: List["Sticker"] = attrs.field(repr=False, factory=list)
    """List of stickers from after this event"""

stickers: List[Sticker] = attrs.field(repr=False, factory=list) class-attribute

List of stickers from after this event

GuildUnavailable

Bases: GuildEvent

Dispatched when a guild is not available.

Source code in interactions/api/events/discord.py
333
334
335
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildUnavailable(GuildEvent):
    """Dispatched when a guild is not available."""

GuildUpdate

Bases: BaseEvent

Dispatched when a guild is updated.

Source code in interactions/api/events/discord.py
303
304
305
306
307
308
309
310
311
312
313
314
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class GuildUpdate(BaseEvent):
    """Dispatched when a guild is updated."""

    before: "Guild" = attrs.field(
        repr=False,
    )
    """Guild before this event"""
    after: "Guild" = attrs.field(
        repr=False,
    )
    """Guild after this event"""

after: Guild = attrs.field(repr=False) class-attribute

Guild after this event

before: Guild = attrs.field(repr=False) class-attribute

Guild before this event

IntegrationCreate

Bases: BaseEvent

Dispatched when a guild integration is created.

Source code in interactions/api/events/discord.py
467
468
469
470
471
472
473
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class IntegrationCreate(BaseEvent):
    """Dispatched when a guild integration is created."""

    integration: "GuildIntegration" = attrs.field(
        repr=False,
    )

IntegrationDelete

Bases: GuildEvent

Dispatched when a guild integration is deleted.

Source code in interactions/api/events/discord.py
481
482
483
484
485
486
487
488
489
490
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class IntegrationDelete(GuildEvent):
    """Dispatched when a guild integration is deleted."""

    id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The ID of the integration"""
    application_id: "Snowflake_Type" = attrs.field(repr=False, default=None)
    """The ID of the bot/application for this integration"""

application_id: Snowflake_Type = attrs.field(repr=False, default=None) class-attribute

The ID of the bot/application for this integration

id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the integration

IntegrationUpdate

Bases: IntegrationCreate

Dispatched when a guild integration is updated.

Source code in interactions/api/events/discord.py
476
477
478
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class IntegrationUpdate(IntegrationCreate):
    """Dispatched when a guild integration is updated."""

InteractionCreate

Bases: BaseEvent

Dispatched when a user uses an Application Command.

Source code in interactions/api/events/discord.py
736
737
738
739
740
741
742
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class InteractionCreate(BaseEvent):
    """Dispatched when a user uses an Application Command."""

    interaction: dict = attrs.field(
        repr=False,
    )

InviteCreate

Bases: BaseEvent

Dispatched when a guild invite is created.

Source code in interactions/api/events/discord.py
493
494
495
496
497
498
499
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class InviteCreate(BaseEvent):
    """Dispatched when a guild invite is created."""

    invite: interactions.models.Invite = attrs.field(
        repr=False,
    )

InviteDelete

Bases: InviteCreate

Dispatched when an invite is deleted.

Source code in interactions/api/events/discord.py
502
503
504
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class InviteDelete(InviteCreate):
    """Dispatched when an invite is deleted."""

MemberAdd

Bases: GuildEvent

Dispatched when a member is added to a guild.

Source code in interactions/api/events/discord.py
368
369
370
371
372
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MemberAdd(GuildEvent):
    """Dispatched when a member is added to a guild."""

    member: "Member" = attrs.field(repr=False, metadata=docs("The member who was added"))

MemberRemove

Bases: MemberAdd

Dispatched when a member is removed from a guild.

Source code in interactions/api/events/discord.py
375
376
377
378
379
380
381
382
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MemberRemove(MemberAdd):
    """Dispatched when a member is removed from a guild."""

    member: Union["Member", "User"] = attrs.field(
        repr=False,
        metadata=docs("The member who was added, can be user if the member is not cached"),
    )

MemberUpdate

Bases: GuildEvent

Dispatched when a member is updated.

Source code in interactions/api/events/discord.py
385
386
387
388
389
390
391
392
393
394
395
396
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MemberUpdate(GuildEvent):
    """Dispatched when a member is updated."""

    before: "Member" = attrs.field(
        repr=False,
    )
    """The state of the member before this event"""
    after: "Member" = attrs.field(
        repr=False,
    )
    """The state of the member after this event"""

after: Member = attrs.field(repr=False) class-attribute

The state of the member after this event

before: Member = attrs.field(repr=False) class-attribute

The state of the member before this event

MessageCreate

Bases: BaseEvent

Dispatched when a message is created.

Source code in interactions/api/events/discord.py
507
508
509
510
511
512
513
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageCreate(BaseEvent):
    """Dispatched when a message is created."""

    message: "Message" = attrs.field(
        repr=False,
    )

MessageDelete

Bases: BaseEvent

Dispatched when a message is deleted.

Source code in interactions/api/events/discord.py
530
531
532
533
534
535
536
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageDelete(BaseEvent):
    """Dispatched when a message is deleted."""

    message: "Message" = attrs.field(
        repr=False,
    )

MessageDeleteBulk

Bases: GuildEvent

Dispatched when multiple messages are deleted at once.

Source code in interactions/api/events/discord.py
539
540
541
542
543
544
545
546
547
548
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageDeleteBulk(GuildEvent):
    """Dispatched when multiple messages are deleted at once."""

    channel_id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The ID of the channel these were deleted in"""
    ids: List["Snowflake_Type"] = attrs.field(repr=False, factory=list)
    """A list of message snowflakes"""

channel_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the channel these were deleted in

ids: List[Snowflake_Type] = attrs.field(repr=False, factory=list) class-attribute

A list of message snowflakes

MessagePollVoteAdd

Bases: BaseMessagePollEvent

Dispatched when a user votes in a poll

Source code in interactions/api/events/discord.py
650
651
652
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessagePollVoteAdd(BaseMessagePollEvent):
    """Dispatched when a user votes in a poll"""

MessagePollVoteRemove

Bases: BaseMessagePollEvent

Dispatched when a user remotes a votes in a poll

Source code in interactions/api/events/discord.py
655
656
657
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessagePollVoteRemove(BaseMessagePollEvent):
    """Dispatched when a user remotes a votes in a poll"""

MessageReactionAdd

Bases: BaseEvent

Dispatched when a reaction is added to a message.

Source code in interactions/api/events/discord.py
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageReactionAdd(BaseEvent):
    """Dispatched when a reaction is added to a message."""

    message: "Message" = attrs.field(repr=False, metadata=docs("The message that was reacted to"))
    emoji: "PartialEmoji" = attrs.field(repr=False, metadata=docs("The emoji that was added to the message"))
    author: Union["Member", "User"] = attrs.field(repr=False, metadata=docs("The user who added the reaction"))
    # reaction can be None when the message is not in the cache, and it was the last reaction, and it was deleted in the event
    reaction: Optional["Reaction"] = attrs.field(
        repr=False, default=None, metadata=docs("The reaction object corresponding to the emoji")
    )

    @property
    def reaction_count(self) -> int:
        """Times the emoji in the event has been used to react"""
        return 0 if self.reaction is None else self.reaction.count

reaction_count: int property

Times the emoji in the event has been used to react

MessageReactionRemove

Bases: MessageReactionAdd

Dispatched when a reaction is removed.

Source code in interactions/api/events/discord.py
569
570
571
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageReactionRemove(MessageReactionAdd):
    """Dispatched when a reaction is removed."""

MessageReactionRemoveAll

Bases: GuildEvent

Dispatched when all reactions are removed from a message.

Source code in interactions/api/events/discord.py
574
575
576
577
578
579
580
581
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageReactionRemoveAll(GuildEvent):
    """Dispatched when all reactions are removed from a message."""

    message: "Message" = attrs.field(
        repr=False,
    )
    """The message that was reacted to"""

message: Message = attrs.field(repr=False) class-attribute

The message that was reacted to

MessageReactionRemoveEmoji

Bases: MessageReactionRemoveAll

Dispatched when all reactions of a specifc emoji are removed from a message.

Source code in interactions/api/events/discord.py
584
585
586
587
588
589
590
591
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageReactionRemoveEmoji(MessageReactionRemoveAll):
    """Dispatched when all reactions of a specifc emoji are removed from a message."""

    emoji: "PartialEmoji" = attrs.field(
        repr=False,
    )
    """The emoji that was removed"""

emoji: PartialEmoji = attrs.field(repr=False) class-attribute

The emoji that was removed

MessageUpdate

Bases: BaseEvent

Dispatched when a message is edited.

Source code in interactions/api/events/discord.py
516
517
518
519
520
521
522
523
524
525
526
527
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class MessageUpdate(BaseEvent):
    """Dispatched when a message is edited."""

    before: "Message" = attrs.field(
        repr=False,
    )
    """The message before this event was created"""
    after: "Message" = attrs.field(
        repr=False,
    )
    """The message after this event was created"""

after: Message = attrs.field(repr=False) class-attribute

The message after this event was created

before: Message = attrs.field(repr=False) class-attribute

The message before this event was created

NewThreadCreate

Bases: ThreadCreate

Dispatched when a thread is newly created.

Source code in interactions/api/events/discord.py
220
221
222
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class NewThreadCreate(ThreadCreate):
    """Dispatched when a thread is newly created."""

PresenceUpdate

Bases: BaseEvent

A user's presence has changed.

Source code in interactions/api/events/discord.py
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class PresenceUpdate(BaseEvent):
    """A user's presence has changed."""

    user: "User" = attrs.field(
        repr=False,
    )
    """The user in question"""
    status: str = attrs.field(
        repr=False,
    )
    """'Either `idle`, `dnd`, `online`, or `offline`'"""
    activities: List["Activity"] = attrs.field(
        repr=False,
    )
    """The users current activities"""
    client_status: dict = attrs.field(
        repr=False,
    )
    """What platform the user is reported as being on"""
    guild_id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The guild this presence update was dispatched from"""

activities: List[Activity] = attrs.field(repr=False) class-attribute

The users current activities

client_status: dict = attrs.field(repr=False) class-attribute

What platform the user is reported as being on

guild_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The guild this presence update was dispatched from

status: str = attrs.field(repr=False) class-attribute

'Either idle, dnd, online, or offline'

user: User = attrs.field(repr=False) class-attribute

The user in question

RoleCreate

Bases: GuildEvent

Dispatched when a role is created.

Source code in interactions/api/events/discord.py
399
400
401
402
403
404
405
406
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class RoleCreate(GuildEvent):
    """Dispatched when a role is created."""

    role: "Role" = attrs.field(
        repr=False,
    )
    """The created role"""

role: Role = attrs.field(repr=False) class-attribute

The created role

RoleDelete

Bases: GuildEvent

Dispatched when a guild role is deleted.

Source code in interactions/api/events/discord.py
423
424
425
426
427
428
429
430
431
432
433
434
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class RoleDelete(GuildEvent):
    """Dispatched when a guild role is deleted."""

    id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The ID of the deleted role"""
    role: Absent["Role"] = attrs.field(
        repr=False,
    )
    """The deleted role"""

id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the deleted role

role: Absent[Role] = attrs.field(repr=False) class-attribute

The deleted role

RoleUpdate

Bases: GuildEvent

Dispatched when a role is updated.

Source code in interactions/api/events/discord.py
409
410
411
412
413
414
415
416
417
418
419
420
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class RoleUpdate(GuildEvent):
    """Dispatched when a role is updated."""

    before: Absent["Role"] = attrs.field(
        repr=False,
    )
    """The role before this event"""
    after: "Role" = attrs.field(
        repr=False,
    )
    """The role after this event"""

after: Role = attrs.field(repr=False) class-attribute

The role after this event

before: Absent[Role] = attrs.field(repr=False) class-attribute

The role before this event

StageInstanceCreate

Bases: BaseEvent

Dispatched when a stage instance is created.

Source code in interactions/api/events/discord.py
686
687
688
689
690
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class StageInstanceCreate(BaseEvent):
    """Dispatched when a stage instance is created."""

    stage_instance: "StageInstance" = attrs.field(repr=False, metadata=docs("The stage instance"))

StageInstanceDelete

Bases: StageInstanceCreate

Dispatched when a stage instance is deleted.

Source code in interactions/api/events/discord.py
693
694
695
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class StageInstanceDelete(StageInstanceCreate):
    """Dispatched when a stage instance is deleted."""

StageInstanceUpdate

Bases: StageInstanceCreate

Dispatched when a stage instance is updated.

Source code in interactions/api/events/discord.py
698
699
700
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class StageInstanceUpdate(StageInstanceCreate):
    """Dispatched when a stage instance is updated."""

ThreadCreate

Bases: BaseEvent

Dispatched when a thread is created, or a thread is new to the client

Source code in interactions/api/events/discord.py
213
214
215
216
217
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadCreate(BaseEvent):
    """Dispatched when a thread is created, or a thread is new to the client"""

    thread: "TYPE_THREAD_CHANNEL" = attrs.field(repr=False, metadata=docs("The thread this event is dispatched from"))

ThreadDelete

Bases: ThreadCreate

Dispatched when a thread is deleted.

Source code in interactions/api/events/discord.py
230
231
232
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadDelete(ThreadCreate):
    """Dispatched when a thread is deleted."""

ThreadListSync

Bases: BaseEvent

Dispatched when gaining access to a channel, contains all active threads in that channel.

Source code in interactions/api/events/discord.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadListSync(BaseEvent):
    """Dispatched when gaining access to a channel, contains all active threads in that channel."""

    channel_ids: Sequence["Snowflake_Type"] = attrs.field(
        repr=False,
    )
    """The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data."""
    threads: List["TYPE_ALL_CHANNEL"] = attrs.field(
        repr=False,
    )
    """all active threads in the given channels that the current user can access"""
    members: List["Member"] = attrs.field(
        repr=False,
    )
    """all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to"""

channel_ids: Sequence[Snowflake_Type] = attrs.field(repr=False) class-attribute

The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data.

members: List[Member] = attrs.field(repr=False) class-attribute

all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to

threads: List[TYPE_ALL_CHANNEL] = attrs.field(repr=False) class-attribute

all active threads in the given channels that the current user can access

ThreadMemberUpdate

Bases: ThreadCreate

Dispatched when the thread member object for the current user is updated.

??? info "Note from Discord" This event is documented for completeness, but unlikely to be used by most bots. For bots, this event largely is just a signal that you are a member of the thread

Source code in interactions/api/events/discord.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadMemberUpdate(ThreadCreate):
    """
    Dispatched when the thread member object for the current user is updated.

    ??? info "Note from Discord"     This event is documented for
    completeness, but unlikely to be used by most bots. For bots, this
    event largely is just a signal that you are a member of the thread

    """

    member: "Member" = attrs.field(
        repr=False,
    )
    """The member who was added"""

member: Member = attrs.field(repr=False) class-attribute

The member who was added

ThreadMembersUpdate

Bases: GuildEvent

Dispatched when anyone is added or removed from a thread.

Source code in interactions/api/events/discord.py
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadMembersUpdate(GuildEvent):
    """Dispatched when anyone is added or removed from a thread."""

    id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The ID of the thread"""
    member_count: int = attrs.field(repr=False, default=50)
    """the approximate number of members in the thread, capped at 50"""
    added_members: List["Member"] = attrs.field(repr=False, factory=list)
    """Users added to the thread"""
    removed_member_ids: List["Snowflake_Type"] = attrs.field(repr=False, factory=list)
    """Users removed from the thread"""

    @property
    def channel(self) -> Optional["TYPE_THREAD_CHANNEL"]:
        """The thread channel this event is dispatched from"""
        return self.client.get_channel(self.id)

added_members: List[Member] = attrs.field(repr=False, factory=list) class-attribute

Users added to the thread

channel: Optional[TYPE_THREAD_CHANNEL] property

The thread channel this event is dispatched from

id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the thread

member_count: int = attrs.field(repr=False, default=50) class-attribute

the approximate number of members in the thread, capped at 50

removed_member_ids: List[Snowflake_Type] = attrs.field(repr=False, factory=list) class-attribute

Users removed from the thread

ThreadUpdate

Bases: ThreadCreate

Dispatched when a thread is updated.

Source code in interactions/api/events/discord.py
225
226
227
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class ThreadUpdate(ThreadCreate):
    """Dispatched when a thread is updated."""

TypingStart

Bases: BaseEvent

Dispatched when a user starts typing.

Source code in interactions/api/events/discord.py
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class TypingStart(BaseEvent):
    """Dispatched when a user starts typing."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )
    """The user who started typing"""
    channel: "TYPE_ALL_CHANNEL" = attrs.field(
        repr=False,
    )
    """The channel typing is in"""
    guild: "Guild" = attrs.field(
        repr=False,
    )
    """The ID of the guild this typing is in"""
    timestamp: "Timestamp" = attrs.field(
        repr=False,
    )
    """unix time (in seconds) of when the user started typing"""

author: Union[User, Member] = attrs.field(repr=False) class-attribute

The user who started typing

channel: TYPE_ALL_CHANNEL = attrs.field(repr=False) class-attribute

The channel typing is in

guild: Guild = attrs.field(repr=False) class-attribute

The ID of the guild this typing is in

timestamp: Timestamp = attrs.field(repr=False) class-attribute

unix time (in seconds) of when the user started typing

VoiceStateUpdate

Bases: BaseEvent

Dispatched when a user's voice state changes.

Source code in interactions/api/events/discord.py
745
746
747
748
749
750
751
752
753
754
755
756
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceStateUpdate(BaseEvent):
    """Dispatched when a user's voice state changes."""

    before: Optional["VoiceState"] = attrs.field(
        repr=False,
    )
    """The voice state before this event was created or None if the user was not in a voice channel"""
    after: Optional["VoiceState"] = attrs.field(
        repr=False,
    )
    """The voice state after this event was created or None if the user is no longer in a voice channel"""

after: Optional[VoiceState] = attrs.field(repr=False) class-attribute

The voice state after this event was created or None if the user is no longer in a voice channel

before: Optional[VoiceState] = attrs.field(repr=False) class-attribute

The voice state before this event was created or None if the user was not in a voice channel

VoiceUserDeafen

Bases: BaseVoiceEvent

Dispatched when a user is deafened or undeafened.

Source code in interactions/api/events/discord.py
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceUserDeafen(BaseVoiceEvent):
    """Dispatched when a user is deafened or undeafened."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )
    """The user who was deafened or undeafened"""
    channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The voice channel the user was deafened or undeafened in"""
    deaf: bool = attrs.field(
        repr=False,
    )
    """The new deaf state of the user"""

author: Union[User, Member] = attrs.field(repr=False) class-attribute

The user who was deafened or undeafened

channel: VoiceChannel = attrs.field(repr=False) class-attribute

The voice channel the user was deafened or undeafened in

deaf: bool = attrs.field(repr=False) class-attribute

The new deaf state of the user

VoiceUserJoin

Bases: BaseVoiceEvent

Dispatched when a user joins a voice channel.

Source code in interactions/api/events/discord.py
821
822
823
824
825
826
827
828
829
830
831
832
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceUserJoin(BaseVoiceEvent):
    """Dispatched when a user joins a voice channel."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )
    """The user who joined the voice channel"""
    channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The voice channel the user joined"""

author: Union[User, Member] = attrs.field(repr=False) class-attribute

The user who joined the voice channel

channel: VoiceChannel = attrs.field(repr=False) class-attribute

The voice channel the user joined

VoiceUserLeave

Bases: BaseVoiceEvent

Dispatched when a user leaves a voice channel.

Source code in interactions/api/events/discord.py
835
836
837
838
839
840
841
842
843
844
845
846
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceUserLeave(BaseVoiceEvent):
    """Dispatched when a user leaves a voice channel."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )
    """The user who left the voice channel"""
    channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The voice channel the user left"""

author: Union[User, Member] = attrs.field(repr=False) class-attribute

The user who left the voice channel

channel: VoiceChannel = attrs.field(repr=False) class-attribute

The voice channel the user left

VoiceUserMove

Bases: BaseVoiceEvent

Dispatched when a user moves voice channels.

Source code in interactions/api/events/discord.py
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceUserMove(BaseVoiceEvent):
    """Dispatched when a user moves voice channels."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )

    previous_channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The previous voice channel the user was in"""
    new_channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The new voice channel the user is in"""

new_channel: VoiceChannel = attrs.field(repr=False) class-attribute

The new voice channel the user is in

previous_channel: VoiceChannel = attrs.field(repr=False) class-attribute

The previous voice channel the user was in

VoiceUserMute

Bases: BaseVoiceEvent

Dispatched when a user is muted or unmuted.

Source code in interactions/api/events/discord.py
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class VoiceUserMute(BaseVoiceEvent):
    """Dispatched when a user is muted or unmuted."""

    author: Union["User", "Member"] = attrs.field(
        repr=False,
    )
    """The user who was muted or unmuted"""
    channel: "VoiceChannel" = attrs.field(
        repr=False,
    )
    """The voice channel the user was muted or unmuted in"""
    mute: bool = attrs.field(
        repr=False,
    )
    """The new mute state of the user"""

author: Union[User, Member] = attrs.field(repr=False) class-attribute

The user who was muted or unmuted

channel: VoiceChannel = attrs.field(repr=False) class-attribute

The voice channel the user was muted or unmuted in

mute: bool = attrs.field(repr=False) class-attribute

The new mute state of the user

WebhooksUpdate

Bases: GuildEvent

Dispatched when a guild channel webhook is created, updated, or deleted.

Source code in interactions/api/events/discord.py
725
726
727
728
729
730
731
732
733
@attrs.define(eq=False, order=False, hash=False, kw_only=False)
class WebhooksUpdate(GuildEvent):
    """Dispatched when a guild channel webhook is created, updated, or deleted."""

    # Discord doesnt sent the webhook object for this event, for some reason
    channel_id: "Snowflake_Type" = attrs.field(
        repr=False,
    )
    """The ID of the webhook was updated"""

channel_id: Snowflake_Type = attrs.field(repr=False) class-attribute

The ID of the webhook was updated