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:

The event classes outlined here are in CamelCase to comply with Class naming convention, however the event names are actually in lower_case_with_underscores so your listeners should be named as following:

1
2
3
4
5
6
7
8
9
@listen()
def on_ready():
    # ready events pass no data, so dont have params
    print("Im ready!")

@listen()
def on_guild_join(event):
    # guild_create events pass a guild object, expect a single param
    print(f"{event.guild.name} created")

Warning

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

attrs class RawGatewayEvent (BaseEvent)

An event dispatched from the gateway.

Holds the raw dict that the gateway dispatches

Attr attributes:

Name Type Description
data dict

Raw Data from the gateway

Source code in naff/api/events/discord.py
@define(kw_only=False)
class RawGatewayEvent(BaseEvent):
    """
    An event dispatched from the gateway.

    Holds the raw dict that the gateway dispatches

    """

    data: dict = field(factory=dict)
    """Raw Data from the gateway"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class AutoModExec (BaseEvent)

Dispatched when an auto modation action is executed

Attr attributes:

Name Type Description
execution AutoModerationAction

The executed auto mod action

channel BaseChannel

The channel the action was executed in

guild Guild

The guild the action was executed in

Source code in naff/api/events/discord.py
@define(kw_only=False)
class AutoModExec(BaseEvent):
    """Dispatched when an auto modation action is executed"""

    execution: "AutoModerationAction" = field(metadata=docs("The executed auto mod action"))
    channel: "BaseChannel" = field(metadata=docs("The channel the action was executed in"))
    guild: "Guild" = field(metadata=docs("The guild the action was executed in"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class AutoModCreated (BaseEvent)

Attr attributes:

Name Type Description
guild Guild

The guild the rule was modified in

rule AutoModRule

The rule that was modified

Source code in naff/api/events/discord.py
@define(kw_only=False)
class AutoModCreated(BaseEvent):
    guild: "Guild" = field(metadata=docs("The guild the rule was modified in"))
    rule: "AutoModRule" = field(metadata=docs("The rule that was modified"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class AutoModUpdated (AutoModCreated)

Dispatched when an auto mod rule is modified

Attr attributes:

Name Type Description
guild Guild

The guild the rule was modified in

rule AutoModRule

The rule that was modified

Source code in naff/api/events/discord.py
@define(kw_only=False)
class AutoModUpdated(AutoModCreated):
    """Dispatched when an auto mod rule is modified"""

    ...

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class AutoModDeleted (AutoModCreated)

Dispatched when an auto mod rule is deleted

Attr attributes:

Name Type Description
guild Guild

The guild the rule was modified in

rule AutoModRule

The rule that was modified

Source code in naff/api/events/discord.py
@define(kw_only=False)
class AutoModDeleted(AutoModCreated):
    """Dispatched when an auto mod rule is deleted"""

    ...

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ChannelCreate (BaseEvent)

Dispatched when a channel is created.

Attr attributes:

Name Type Description
channel BaseChannel

The channel this event is dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ChannelCreate(BaseEvent):
    """Dispatched when a channel is created."""

    channel: "BaseChannel" = field(metadata=docs("The channel this event is dispatched from"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ChannelUpdate (BaseEvent)

Dispatched when a channel is updated.

Attr attributes:

Name Type Description
before BaseChannel

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

after BaseChannel

Channel after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ChannelUpdate(BaseEvent):
    """Dispatched when a channel is updated."""

    before: "BaseChannel" = field()
    """Channel before this event. MISSING if it was not cached before"""
    after: "BaseChannel" = field()
    """Channel after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ChannelDelete (ChannelCreate)

Dispatched when a channel is deleted.

Attr attributes:

Name Type Description
channel BaseChannel

The channel this event is dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ChannelDelete(ChannelCreate):
    """Dispatched when a channel is deleted."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ChannelPinsUpdate (ChannelCreate)

Dispatched when a channel's pins are updated.

Attr attributes:

Name Type Description
channel BaseChannel

The channel this event is dispatched from

last_pin_timestamp Timestamp

The time at which the most recent pinned message was pinned

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ChannelPinsUpdate(ChannelCreate):
    """Dispatched when a channel's pins are updated."""

    last_pin_timestamp: "Timestamp" = field()
    """The time at which the most recent pinned message was pinned"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ThreadCreate (BaseEvent)

Dispatched when a thread is created.

Attr attributes:

Name Type Description
thread TYPE_THREAD_CHANNEL

The thread this event is dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ThreadCreate(BaseEvent):
    """Dispatched when a thread is created."""

    thread: "TYPE_THREAD_CHANNEL" = field(metadata=docs("The thread this event is dispatched from"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ThreadUpdate (ThreadCreate)

Dispatched when a thread is updated.

Attr attributes:

Name Type Description
thread TYPE_THREAD_CHANNEL

The thread this event is dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ThreadUpdate(ThreadCreate):
    """Dispatched when a thread is updated."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ThreadDelete (ThreadCreate)

Dispatched when a thread is deleted.

Attr attributes:

Name Type Description
thread TYPE_THREAD_CHANNEL

The thread this event is dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ThreadDelete(ThreadCreate):
    """Dispatched when a thread is deleted."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ThreadListSync (BaseEvent)

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

Attr attributes:

Name Type Description
channel_ids List[Snowflake_Type]

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[BaseChannel]

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

members List[Member]

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

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ThreadListSync(BaseEvent):
    """Dispatched when gaining access to a channel, contains all active threads in that channel."""

    channel_ids: List["Snowflake_Type"] = field()
    """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["BaseChannel"] = field()
    """all active threads in the given channels that the current user can access"""
    members: List["Member"] = field()
    """all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs 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

Attr attributes:

Name Type Description
thread TYPE_THREAD_CHANNEL

The thread this event is dispatched from

member Member

The member who was added

Source code in naff/api/events/discord.py
@define(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" = field()
    """The member who was added"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ThreadMembersUpdate (BaseEvent)

Dispatched when anyone is added or removed from a thread.

Attr attributes:

Name Type Description
id Snowflake_Type

The ID of the thread

member_count int

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

added_members List[Member]

Users added to the thread

removed_member_ids List[Snowflake_Type]

Users removed from the thread

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ThreadMembersUpdate(BaseEvent):
    """Dispatched when anyone is added or removed from a thread."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class GuildJoin (BaseEvent)

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.

Attr attributes:

Name Type Description
guild Guild

The guild that was created

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildJoin(BaseEvent):
    """
    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.

    """

    guild: "Guild" = field()
    """The guild that was created"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class GuildUpdate (BaseEvent)

Dispatched when a guild is updated.

Attr attributes:

Name Type Description
before Guild

Guild before this event

after Guild

Guild after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildUpdate(BaseEvent):
    """Dispatched when a guild is updated."""

    before: "Guild" = field()
    """Guild before this event"""
    after: "Guild" = field()
    """Guild after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class GuildLeft (BaseEvent, GuildEvent)

Dispatched when a guild is left.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

guild Optional[Guild]

The guild, if it was cached

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildLeft(BaseEvent, GuildEvent):
    """Dispatched when a guild is left."""

    guild: Optional["Guild"] = field(default=MISSING)
    """The guild, if it was cached"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class GuildUnavailable (BaseEvent, GuildEvent)

Dispatched when a guild is not available.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

guild Optional[Guild]

The guild, if it was cached

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildUnavailable(BaseEvent, GuildEvent):
    """Dispatched when a guild is not available."""

    guild: Optional["Guild"] = field(default=MISSING)
    """The guild, if it was cached"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class BanCreate (BaseEvent, GuildEvent)

Dispatched when someone was banned from a guild.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

user BaseUser

The user

Source code in naff/api/events/discord.py
@define(kw_only=False)
class BanCreate(BaseEvent, GuildEvent):
    """Dispatched when someone was banned from a guild."""

    user: "BaseUser" = field(metadata=docs("The user"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class BanRemove (BanCreate)

Dispatched when a users ban is removed.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

user BaseUser

The user

Source code in naff/api/events/discord.py
@define(kw_only=False)
class BanRemove(BanCreate):
    """Dispatched when a users ban is removed."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class GuildEmojisUpdate (BaseEvent, GuildEvent)

Dispatched when a guild's emojis are updated.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

before List[CustomEmoji]

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]

List of emoji after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildEmojisUpdate(BaseEvent, GuildEvent):
    """Dispatched when a guild's emojis are updated."""

    before: List["CustomEmoji"] = field(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"] = field(factory=list)
    """List of emoji after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class GuildStickersUpdate (BaseEvent, GuildEvent)

Dispatched when a guild's stickers are updated.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

stickers List[Sticker]

List of stickers from after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildStickersUpdate(BaseEvent, GuildEvent):
    """Dispatched when a guild's stickers are updated."""

    stickers: List["Sticker"] = field(factory=list)
    """List of stickers from after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class MemberAdd (BaseEvent, GuildEvent)

Dispatched when a member is added to a guild.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

member Member

The member who was added

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MemberAdd(BaseEvent, GuildEvent):
    """Dispatched when a member is added to a guild."""

    member: "Member" = field(metadata=docs("The member who was added"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class MemberRemove (MemberAdd)

Dispatched when a member is removed from a guild.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

member Union[Member, User]

The member who was added, can be user if the member is not cached

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MemberRemove(MemberAdd):
    """Dispatched when a member is removed from a guild."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class MemberUpdate (BaseEvent, GuildEvent)

Dispatched when a member is updated.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

before Member

The state of the member before this event

after Member

The state of the member after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MemberUpdate(BaseEvent, GuildEvent):
    """Dispatched when a member is updated."""

    before: "Member" = field()
    """The state of the member before this event"""
    after: "Member" = field()
    """The state of the member after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class RoleCreate (BaseEvent, GuildEvent)

Dispatched when a role is created.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

role Role

The created role

Source code in naff/api/events/discord.py
@define(kw_only=False)
class RoleCreate(BaseEvent, GuildEvent):
    """Dispatched when a role is created."""

    role: "Role" = field()
    """The created role"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class RoleUpdate (BaseEvent, GuildEvent)

Dispatched when a role is updated.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

before Union[Role, naff.client.const.Missing]

The role before this event

after Role

The role after this event

Source code in naff/api/events/discord.py
@define(kw_only=False)
class RoleUpdate(BaseEvent, GuildEvent):
    """Dispatched when a role is updated."""

    before: Absent["Role"] = field()
    """The role before this event"""
    after: "Role" = field()
    """The role after this event"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class RoleDelete (BaseEvent, GuildEvent)

Dispatched when a guild role is deleted.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

id Snowflake_Type

The ID of the deleted role

role Union[Role, naff.client.const.Missing]

The deleted role

Source code in naff/api/events/discord.py
@define(kw_only=False)
class RoleDelete(BaseEvent, GuildEvent):
    """Dispatched when a guild role is deleted."""

    id: "Snowflake_Type" = field()
    """The ID of the deleted role"""
    role: Absent["Role"] = field()
    """The deleted role"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class GuildMembersChunk (BaseEvent, 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.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

chunk_index int

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

chunk_count int

the total number of expected chunks for this response

presences List

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

nonce str

The nonce used in the request, if any

members List[Member]

A list of members

Source code in naff/api/events/discord.py
@define(kw_only=False)
class GuildMembersChunk(BaseEvent, 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 = field()
    """The chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count)"""
    chunk_count: int = field()
    """the total number of expected chunks for this response"""
    presences: List = field()
    """if passing true to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here"""
    nonce: str = field()
    """The nonce used in the request, if any"""
    members: List["Member"] = field(factory=list)
    """A list of members"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class IntegrationCreate (BaseEvent)

Dispatched when a guild integration is created.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class IntegrationCreate(BaseEvent):
    """Dispatched when a guild integration is created."""

    integration: "GuildIntegration" = field()

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class IntegrationUpdate (IntegrationCreate)

Dispatched when a guild integration is updated.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class IntegrationUpdate(IntegrationCreate):
    """Dispatched when a guild integration is updated."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class IntegrationDelete (BaseEvent, GuildEvent)

Dispatched when a guild integration is deleted.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

id Snowflake_Type

The ID of the integration

application_id Snowflake_Type

The ID of the bot/application for this integration

Source code in naff/api/events/discord.py
@define(kw_only=False)
class IntegrationDelete(BaseEvent, GuildEvent):
    """Dispatched when a guild integration is deleted."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class InviteCreate (BaseEvent)

Dispatched when a guild invite is created.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class InviteCreate(BaseEvent):
    """Dispatched when a guild invite is created."""

    invite: naff.models.Invite = field()

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class InviteDelete (InviteCreate)

Dispatched when an invite is deleted.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class InviteDelete(InviteCreate):
    """Dispatched when an invite is deleted."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class MessageCreate (BaseEvent)

Dispatched when a message is created.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageCreate(BaseEvent):
    """Dispatched when a message is created."""

    message: "Message" = field()

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class MessageUpdate (BaseEvent)

Dispatched when a message is edited.

Attr attributes:

Name Type Description
before Message

The message before this event was created

after Message

The message after this event was created

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageUpdate(BaseEvent):
    """Dispatched when a message is edited."""

    before: "Message" = field()
    """The message before this event was created"""
    after: "Message" = field()
    """The message after this event was created"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class MessageDelete (BaseEvent)

Dispatched when a message is deleted.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageDelete(BaseEvent):
    """Dispatched when a message is deleted."""

    message: "Message" = field()

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class MessageDeleteBulk (BaseEvent, GuildEvent)

Dispatched when multiple messages are deleted at once.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

channel_id Snowflake_Type

The ID of the channel these were deleted in

ids List[Snowflake_Type]

A list of message snowflakes

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageDeleteBulk(BaseEvent, GuildEvent):
    """Dispatched when multiple messages are deleted at once."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class MessageReactionAdd (BaseEvent)

Dispatched when a reaction is added to a message.

Attr attributes:

Name Type Description
message Message

The message that was reacted to

emoji PartialEmoji

The emoji that was added to the message

author Union[Member, User]

The user who added the reaction

reaction Optional[Reaction]

The reaction object corresponding to the emoji

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageReactionAdd(BaseEvent):
    """Dispatched when a reaction is added to a message."""

    message: "Message" = field(metadata=docs("The message that was reacted to"))
    emoji: "PartialEmoji" = field(metadata=docs("The emoji that was added to the message"))
    author: Union["Member", "User"] = field(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"] = field(
        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"""
        if self.reaction is None:
            return 0
        return self.reaction.count

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

property readonly reaction_count: int

Times the emoji in the event has been used to react

attrs class MessageReactionRemove (MessageReactionAdd)

Dispatched when a reaction is removed.

Attr attributes:

Name Type Description
message Message

The message that was reacted to

emoji PartialEmoji

The emoji that was added to the message

author Union[Member, User]

The user who added the reaction

reaction Optional[Reaction]

The reaction object corresponding to the emoji

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageReactionRemove(MessageReactionAdd):
    """Dispatched when a reaction is removed."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly reaction_count: int

Times the emoji in the event has been used to react

attrs class MessageReactionRemoveAll (BaseEvent, GuildEvent)

Dispatched when all reactions are removed from a message.

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

message Message

The message that was reacted to

Source code in naff/api/events/discord.py
@define(kw_only=False)
class MessageReactionRemoveAll(BaseEvent, GuildEvent):
    """Dispatched when all reactions are removed from a message."""

    message: "Message" = field()
    """The message that was reacted to"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class PresenceUpdate (BaseEvent)

A user's presence has changed.

Attr attributes:

Name Type Description
user User

The user in question

status str

'Either idle, dnd, online, or offline'

activities List[Activity]

The users current activities

client_status dict

What platform the user is reported as being on

guild_id Snowflake_Type

The guild this presence update was dispatched from

Source code in naff/api/events/discord.py
@define(kw_only=False)
class PresenceUpdate(BaseEvent):
    """A user's presence has changed."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class StageInstanceCreate (BaseEvent)

Dispatched when a stage instance is created.

Attr attributes:

Name Type Description
stage_instance StageInstance

The stage instance

Source code in naff/api/events/discord.py
@define(kw_only=False)
class StageInstanceCreate(BaseEvent):
    """Dispatched when a stage instance is created."""

    stage_instance: "StageInstance" = field(metadata=docs("The stage instance"))

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class StageInstanceDelete (StageInstanceCreate)

Dispatched when a stage instance is deleted.

Attr attributes:

Name Type Description
stage_instance StageInstance

The stage instance

Source code in naff/api/events/discord.py
@define(kw_only=False)
class StageInstanceDelete(StageInstanceCreate):
    """Dispatched when a stage instance is deleted."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class StageInstanceUpdate (StageInstanceCreate)

Dispatched when a stage instance is updated.

Attr attributes:

Name Type Description
stage_instance StageInstance

The stage instance

Source code in naff/api/events/discord.py
@define(kw_only=False)
class StageInstanceUpdate(StageInstanceCreate):
    """Dispatched when a stage instance is updated."""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class TypingStart (BaseEvent)

Dispatched when a user starts typing.

Attr attributes:

Name Type Description
author Union[User, Member]

The user who started typing

channel BaseChannel

The channel typing is in

guild Guild

The ID of the guild this typing is in

timestamp Timestamp

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

Source code in naff/api/events/discord.py
@define(kw_only=False)
class TypingStart(BaseEvent):
    """Dispatched when a user starts typing."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class WebhooksUpdate (BaseEvent, GuildEvent)

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

Attr attributes:

Name Type Description
guild_id Snowflake_Type

The ID of the guild

channel_id Snowflake_Type

The ID of the webhook was updated

Source code in naff/api/events/discord.py
@define(kw_only=False)
class WebhooksUpdate(BaseEvent, 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" = field()
    """The ID of the webhook was updated"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

inherited property readonly guild: Guild

Guild related to event

attrs class InteractionCreate (BaseEvent)

Dispatched when a user uses an Application Command.

Attr attributes:

Name Type Description
Source code in naff/api/events/discord.py
@define(kw_only=False)
class InteractionCreate(BaseEvent):
    """Dispatched when a user uses an Application Command."""

    interaction: dict = field()

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class ModalResponse (BaseEvent)

Dispatched when a modal receives a response

Attr attributes:

Name Type Description
context ModalContext

The context data of the modal

Source code in naff/api/events/discord.py
@define(kw_only=False)
class ModalResponse(BaseEvent):
    """Dispatched when a modal receives a response"""

    context: "ModalContext" = field()
    """The context data of the modal"""

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.

attrs class VoiceStateUpdate (BaseEvent)

Dispatched when a user joins/leaves/moves voice channels.

Attr attributes:

Name Type Description
before Optional[VoiceState]

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

after Optional[VoiceState]

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

Source code in naff/api/events/discord.py
@define(kw_only=False)
class VoiceStateUpdate(BaseEvent):
    """Dispatched when a user joins/leaves/moves voice channels."""

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

inherited property readonly resolved_name: str

The name of the event, defaults to the class name if not overridden.