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 |
|
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 |
|
AutoModDeleted
¶
Bases: AutoModCreated
Dispatched when an auto mod rule is deleted
Source code in interactions/api/events/discord.py
156 157 158 159 160 |
|
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 |
|
AutoModUpdated
¶
Bases: AutoModCreated
Dispatched when an auto mod rule is modified
Source code in interactions/api/events/discord.py
149 150 151 152 153 |
|
BanCreate
¶
Bases: GuildEvent
Dispatched when someone was banned from a guild.
Source code in interactions/api/events/discord.py
338 339 340 341 342 |
|
BanRemove
¶
Bases: BanCreate
Dispatched when a users ban is removed.
Source code in interactions/api/events/discord.py
345 346 347 |
|
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 |
|
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 |
|
fetch_guild()
async
¶
Fetch the guild the poll is in
Source code in interactions/api/events/discord.py
640 641 642 |
|
fetch_message()
async
¶
Fetch the message the poll is in
Source code in interactions/api/events/discord.py
628 629 630 |
|
fetch_poll()
async
¶
Fetch the poll object
Source code in interactions/api/events/discord.py
644 645 646 647 |
|
fetch_user()
async
¶
Fetch the user that voted
Source code in interactions/api/events/discord.py
632 633 634 |
|
get_channel()
¶
Get the channel object if it is cached
Source code in interactions/api/events/discord.py
615 616 617 |
|
get_guild()
¶
Get the guild object if it is cached
Source code in interactions/api/events/discord.py
619 620 621 |
|
get_message()
¶
Get the message object if it is cached
Source code in interactions/api/events/discord.py
607 608 609 |
|
get_poll()
¶
Get the poll object if it is cached
Source code in interactions/api/events/discord.py
623 624 625 626 |
|
get_user()
¶
Get the user object if it is cached
Source code in interactions/api/events/discord.py
611 612 613 |
|
BaseVoiceEvent
¶
Bases: BaseEvent
Source code in interactions/api/events/discord.py
759 760 761 762 763 764 |
|
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 |
|
ChannelDelete
¶
Bases: ChannelCreate
Dispatched when a channel is deleted.
Source code in interactions/api/events/discord.py
198 199 200 |
|
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 |
|
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 |
|
EntitlementCreate
¶
Bases: BaseEntitlementEvent
Dispatched when a user subscribes to a SKU.
Source code in interactions/api/events/discord.py
915 916 917 |
|
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 |
|
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 |
|
GuildAuditLogEntryCreate
¶
Bases: GuildEvent
Dispatched when audit log entry is created
Source code in interactions/api/events/discord.py
849 850 851 852 853 854 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
IntegrationUpdate
¶
Bases: IntegrationCreate
Dispatched when a guild integration is updated.
Source code in interactions/api/events/discord.py
476 477 478 |
|
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 |
|
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 |
|
InviteDelete
¶
Bases: InviteCreate
Dispatched when an invite is deleted.
Source code in interactions/api/events/discord.py
502 503 504 |
|
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 |
|
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 |
|
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 |
|
MessageCreate
¶
Bases: BaseEvent
Dispatched when a message is created.
Source code in interactions/api/events/discord.py
507 508 509 510 511 512 513 |
|
MessageDelete
¶
Bases: BaseEvent
Dispatched when a message is deleted.
Source code in interactions/api/events/discord.py
530 531 532 533 534 535 536 |
|
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 |
|
MessagePollVoteAdd
¶
Bases: BaseMessagePollEvent
Dispatched when a user votes in a poll
Source code in interactions/api/events/discord.py
650 651 652 |
|
MessagePollVoteRemove
¶
Bases: BaseMessagePollEvent
Dispatched when a user remotes a votes in a poll
Source code in interactions/api/events/discord.py
655 656 657 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
NewThreadCreate
¶
Bases: ThreadCreate
Dispatched when a thread is newly created.
Source code in interactions/api/events/discord.py
220 221 222 |
|
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 |
|
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 |
|
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 |
|
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 |
|
StageInstanceCreate
¶
Bases: BaseEvent
Dispatched when a stage instance is created.
Source code in interactions/api/events/discord.py
686 687 688 689 690 |
|
StageInstanceDelete
¶
Bases: StageInstanceCreate
Dispatched when a stage instance is deleted.
Source code in interactions/api/events/discord.py
693 694 695 |
|
StageInstanceUpdate
¶
Bases: StageInstanceCreate
Dispatched when a stage instance is updated.
Source code in interactions/api/events/discord.py
698 699 700 |
|
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 |
|
ThreadDelete
¶
Bases: ThreadCreate
Dispatched when a thread is deleted.
Source code in interactions/api/events/discord.py
230 231 232 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
channel_id: Snowflake_Type = attrs.field(repr=False)
class-attribute
¶
The ID of the webhook was updated