Skip to main content

Discord Events

All Discord events are available through the discord namespace. Set a function to an event property to handle that event in real-time.

Message Events

discord.on_message

Fired when any message is received in Discord.

Event Context

The event receives a ctx object:
PropertyTypeDescription
ctx.messageMessageFull message object (id, content, timestamp, etc.)
ctx.guildGuildFull guild object (name, member_count, icon, etc.)
ctx.channelChannelFull channel object (name, type, topic, etc.)
ctx.authorAuthorFull author object (username, id, avatar, etc.)
ctx.contentstringMessage content (shortcut for ctx.message.content)
ctx.mentionsAuthor[]Mentioned users
ctx.attachmentsAttachment[]Message attachments
ctx.embedsEmbed[]Message embeds

Example

discord.on_message = function(ctx) {
    if (ctx.author.bot) return;
    
    ethone.log("Message from " + ctx.author.username + " in #" + ctx.channel.name);
    
    if (!ctx.guild) {
        discord.send_message(ctx.channel.id, "Thanks for the DM!");
    }
    
    if (ctx.guild && ctx.guild.name === "My Server") {
        if (ctx.content.toLowerCase().includes("hello")) {
            discord.send_message(ctx.channel.id, "Hello in " + ctx.guild.name + "!");
        }
    }
};

discord.on_message_update

Fired when a message is edited.

Event Context

PropertyTypeDescription
ctx.afterMessageFull message object with new content
ctx.beforeMessageFull message object with old content (if cached)
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object
ctx.authorAuthorFull author object

Example

discord.on_message_update = function(ctx) {
    ethone.log("Message edited by " + ctx.author.username);
    ethone.log("  In: #" + ctx.channel.name + " (" + ctx.guild.name + ")");
    
    if (ctx.before) {
        ethone.log("  Old content: " + ctx.before.content);
    }
    ethone.log("  New content: " + ctx.after.content);
    
    var logChannel = "YOUR_LOG_CHANNEL_ID";
    discord.send_message(logChannel, ctx.author.username + " edited a message");
};

discord.on_message_delete

Fired when a message is deleted.

Event Context

PropertyTypeDescription
ctx.messageMessageFull message object (id, cached content if available)
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object

Example

var deletedMessages = [];

discord.on_message_delete = function(ctx) {
    deletedMessages.push({
        id: ctx.message.id,
        channel: ctx.channel.name,
        guild: ctx.guild.name,
        timestamp: Date.now()
    });
    
    ethone.log("Message deleted in #" + ctx.channel.name);
};

discord.on_message_delete_bulk

Fired when multiple messages are deleted at once (e.g., bulk delete).

Event Context

PropertyTypeDescription
ctx.idsstring[]Array of deleted message IDs
ctx.channel_idstringChannel ID where messages were deleted
ctx.guild_idstringGuild ID (if in a server)
ctx.channelChannelFull channel object
ctx.guildGuildFull guild object (if in a server)

Example

discord.on_message_delete_bulk = function(ctx) {
    ethone.log("Bulk delete in #" + ctx.channel.name);
    ethone.log("  Deleted " + ctx.ids.length + " messages");
};

Reaction Events

discord.on_message_reaction_add

Fired when a reaction is added to a message.

Event Context

PropertyTypeDescription
ctx.userAuthorFull user object who added the reaction
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object
ctx.messageMessageFull message object that was reacted to
ctx.emojiEmojiEmoji information (id, name, animated)

Example

discord.on_message_reaction_add = function(ctx) {
    ethone.log("Reaction " + ctx.emoji.name + " by " + ctx.user.username);
    
    if (ctx.emoji.name === "👍") {
        discord.send_message(ctx.channel.id, ctx.user.username + " liked this!");
    }
};

discord.on_message_reaction_remove

Fired when a reaction is removed from a message.

Event Context

Same structure as on_message_reaction_add.

Example

discord.on_message_reaction_remove = function(ctx) {
    ethone.log("Reaction removed: " + ctx.emoji.name + " by " + ctx.user.username);
};

discord.on_message_reaction_remove_all

Fired when all reactions are removed from a message.

Event Context

PropertyTypeDescription
ctx.message_idstringMessage ID
ctx.channel_idstringChannel ID
ctx.guild_idstringGuild ID (if in a server)
ctx.channelChannelFull channel object
ctx.guildGuildFull guild object (if in a server)

Example

discord.on_message_reaction_remove_all = function(ctx) {
    ethone.log("All reactions removed from message " + ctx.message_id);
};

discord.on_message_reaction_remove_emoji

Fired when all reactions of a specific emoji are removed from a message.

Event Context

PropertyTypeDescription
ctx.message_idstringMessage ID
ctx.channel_idstringChannel ID
ctx.guild_idstringGuild ID (if in a server)
ctx.emojiObjectEmoji that was removed
ctx.emoji.namestringEmoji name
ctx.emoji.idstringEmoji ID (custom emojis)
ctx.channelChannelFull channel object
ctx.guildGuildFull guild object (if in a server)

Example

discord.on_message_reaction_remove_emoji = function(ctx) {
    ethone.log("Removed all " + ctx.emoji.name + " reactions");
};

Poll Events

discord.on_message_poll_vote_add

Fired when a user votes in a poll.

Event Context

PropertyTypeDescription
ctx.user_idstringUser who voted
ctx.channel_idstringChannel ID
ctx.message_idstringMessage ID containing the poll
ctx.guild_idstringGuild ID (if in a guild)
ctx.answer_idnumberThe answer ID that was voted for
ctx.channelChannelChannel context
ctx.guildGuildGuild context

Example

discord.on_message_poll_vote_add = function(ctx) {
    ethone.log("User voted on answer " + ctx.answer_id);
};

discord.on_message_poll_vote_remove

Fired when a user removes their vote from a poll.

Event Context

Same structure as on_message_poll_vote_add.

Example

discord.on_message_poll_vote_remove = function(ctx) {
    ethone.log("User removed vote from answer " + ctx.answer_id);
};

Channel Events

discord.on_channel_create

Fired when a channel is created.

Event Context

PropertyTypeDescription
ctx.channelChannelFull channel object (id, name, type, topic, nsfw, etc.)
ctx.guildGuildFull guild object

Example

discord.on_channel_create = function(ctx) {
    ethone.log("New channel: #" + ctx.channel.name);
    ethone.log("  Type: " + ctx.channel.type);
    ethone.log("  Guild: " + ctx.guild.name);
};

discord.on_channel_update

Fired when a channel is updated (name, topic, permissions, etc.).

Event Context

PropertyTypeDescription
ctx.afterChannelUpdated channel object
ctx.beforeChannelPrevious channel state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_channel_update = function(ctx) {
    if (ctx.before && ctx.before.name !== ctx.after.name) {
        ethone.log("Channel renamed: #" + ctx.before.name + " -> #" + ctx.after.name);
    } else {
        ethone.log("Channel updated: #" + ctx.after.name);
    }
    
    if (ctx.after.topic) {
        ethone.log("  Topic: " + ctx.after.topic);
    }
};

discord.on_channel_delete

Fired when a channel is deleted.

Event Context

PropertyTypeDescription
ctx.channelChannelFull channel object (id, name, type)
ctx.guildGuildFull guild object

Example

discord.on_channel_delete = function(ctx) {
    ethone.log("Channel deleted: #" + ctx.channel.name);
};

discord.on_channel_pins_update

Fired when a message is pinned or unpinned in a channel.

Event Context

PropertyTypeDescription
ctx.channel_idstringChannel ID
ctx.guild_idstringGuild ID (if in a server)
ctx.last_pin_timestampstringTimestamp of last pinned message
ctx.channelChannelFull channel object
ctx.guildGuildFull guild object (if in a server)

Example

discord.on_channel_pins_update = function(ctx) {
    ethone.log("Pins updated in #" + ctx.channel.name);
};

discord.on_channel_recipient_add

Fired when a user is added to a group DM.

Event Context

PropertyTypeDescription
ctx.channel_idstringGroup DM channel ID
ctx.userAuthorUser who was added
ctx.nickstringUser’s nickname in the group DM
ctx.channelChannelFull channel object

Example

discord.on_channel_recipient_add = function(ctx) {
    ethone.log(ctx.user.username + " was added to the group");
};

discord.on_channel_recipient_remove

Fired when a user is removed from a group DM.

Event Context

Same structure as on_channel_recipient_add.

Example

discord.on_channel_recipient_remove = function(ctx) {
    ethone.log(ctx.user.username + " left the group");
};

Guild Events

discord.on_guild_create

Fired when YOU join a server or when a server becomes available.
Note: This is different from on_guild_member_add which fires when OTHER users join a server.

Event Context

PropertyTypeDescription
ctx.guildGuildFull guild object

Example

discord.on_guild_create = function(ctx) {
    ethone.send_event("Joined Server", "You joined " + ctx.guild.name, "success");
};

discord.on_guild_update

Fired when a guild is updated (name, icon, settings, etc.).

Event Context

PropertyTypeDescription
ctx.afterGuildUpdated guild object
ctx.beforeGuildPrevious guild state (if cached)

Example

discord.on_guild_update = function(ctx) {
    if (ctx.before && ctx.before.name !== ctx.after.name) {
        ethone.log("Guild renamed: " + ctx.before.name + " -> " + ctx.after.name);
    } else {
        ethone.log("Guild updated: " + ctx.after.name);
    }
};

discord.on_guild_delete

Fired when YOU leave a server or when a server becomes unavailable.

Event Context

PropertyTypeDescription
ctx.guild_idstringID of the guild you left
ctx.unavailablebooleanTrue if the guild is unavailable (outage), false if you left

Example

discord.on_guild_delete = function(ctx) {
    if (!ctx.unavailable) {
        ethone.send_event("Left Server", "You left server ID: " + ctx.guild_id, "warning");
    }
};

discord.on_guild_emojis_update

Fired when a guild’s emojis are updated.

Event Context

PropertyTypeDescription
ctx.guild_idstringGuild ID
ctx.emojisEmoji[]Array of emoji objects
ctx.guildGuildFull guild object

Example

discord.on_guild_emojis_update = function(ctx) {
    ethone.log("Emojis updated in " + ctx.guild.name);
    ethone.log("  Total emojis: " + ctx.emojis.length);
};

discord.on_guild_integrations_update

Fired when a guild’s integrations are updated.

Event Context

PropertyTypeDescription
ctx.guild_idstringThe guild ID
ctx.guildGuildGuild context

Example

discord.on_guild_integrations_update = function(ctx) {
    ethone.log("Integrations updated in " + ctx.guild.name);
};

discord.on_guild_members_chunk

Fired when a chunk of guild members is received.

Event Context

PropertyTypeDescription
ctx.guild_idstringThe guild ID
ctx.membersMember[]Array of member objects
ctx.chunk_indexnumberCurrent chunk index
ctx.chunk_countnumberTotal number of chunks
ctx.noncestringRequest nonce
ctx.guildGuildGuild context

Example

discord.on_guild_members_chunk = function(ctx) {
    ethone.log("Received " + ctx.members.length + " members (chunk " + ctx.chunk_index + "/" + ctx.chunk_count + ")");
};

Member Events

discord.on_guild_member_add

Fired when ANOTHER USER joins a server/guild.
Important: This event only fires when OTHER users join servers, not when YOU join a server. If you want to detect when you join a server, use discord.on_guild_create instead.

Event Context

PropertyTypeDescription
ctx.userAuthorFull user object
ctx.guildGuildFull guild object
ctx.joined_atstringISO timestamp of when they joined
ctx.nickstringTheir server nickname (if set)
ctx.rolesstring[]Array of role IDs assigned

Example

discord.on_guild_member_add = function(ctx) {
    ethone.log("New member: " + ctx.user.username);
    ethone.log("  Guild: " + ctx.guild.name);
    
    discord.send_message("WELCOME_CHANNEL_ID", "Welcome " + ctx.user.username + "!");
};

discord.on_guild_member_update

Fired when a member is updated (roles changed, nickname changed, etc.).

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated member state with user, nick, roles, joined_at
ctx.beforeobjectPrevious member state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_guild_member_update = function(ctx) {
    if (ctx.before && ctx.before.nick !== ctx.after.nick) {
        var oldNick = ctx.before.nick || ctx.after.user.username;
        var newNick = ctx.after.nick || ctx.after.user.username;
        ethone.log("Nickname changed: " + oldNick + " -> " + newNick);
    } else {
        ethone.log("Member updated: " + ctx.after.user.username);
    }
    if (ctx.nick) {
        ethone.log("  Nickname: " + ctx.nick);
    }
};

discord.on_guild_member_remove

Fired when a member leaves or is kicked from a server.

Event Context

PropertyTypeDescription
ctx.userAuthorFull user object
ctx.guildGuildFull guild object

Example

discord.on_guild_member_remove = function(ctx) {
    ethone.log("Member left: " + ctx.user.username);
    ethone.log("  From: " + ctx.guild.name);
};

Role Events

discord.on_guild_role_create

Fired when a role is created.

Event Context

PropertyTypeDescription
ctx.guildGuildFull guild object
ctx.roleRoleFull role object (id, name, color, permissions, etc.)

Example

discord.on_guild_role_create = function(ctx) {
    ethone.log("Role created: " + ctx.role.name);
    ethone.log("  In: " + ctx.guild.name);
};

discord.on_guild_role_update

Fired when a role is updated.

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated role object
ctx.beforeobjectPrevious role state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_guild_role_update = function(ctx) {
    if (ctx.before && ctx.before.name !== ctx.after.name) {
        ethone.log("Role renamed: " + ctx.before.name + " -> " + ctx.after.name);
    } else {
        ethone.log("Role updated: " + ctx.after.name);
    }
};

discord.on_guild_role_delete

Fired when a role is deleted.

Event Context

PropertyTypeDescription
ctx.guildGuildFull guild object
ctx.role_idstringThe deleted role ID

Example

discord.on_guild_role_delete = function(ctx) {
    ethone.log("Role deleted: " + ctx.role_id);
};

Ban Events

discord.on_guild_ban_add

Fired when a user is banned from a guild.

Event Context

PropertyTypeDescription
ctx.userAuthorUser who was banned
ctx.guildGuildFull guild object

Example

discord.on_guild_ban_add = function(ctx) {
    ethone.log("User banned: " + ctx.user.username);
    ethone.log("  From: " + ctx.guild.name);
};

discord.on_guild_ban_remove

Fired when a user is unbanned from a guild.

Event Context

Same structure as on_guild_ban_add.

Example

discord.on_guild_ban_remove = function(ctx) {
    ethone.log("User unbanned: " + ctx.user.username);
};

Thread Events

discord.on_thread_create

Fired when a thread is created.

Event Context

PropertyTypeDescription
ctx.threadChannelThread channel object
ctx.newly_createdbooleanWhether the thread was just created
ctx.guildGuildFull guild object

Example

discord.on_thread_create = function(ctx) {
    ethone.log("Thread created: " + ctx.thread.name);
};

discord.on_thread_update

Fired when a thread is updated.

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated thread object
ctx.beforeobjectPrevious thread state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_thread_update = function(ctx) {
    if (ctx.before && ctx.before.name !== ctx.after.name) {
        ethone.log("Thread renamed: " + ctx.before.name + " -> " + ctx.after.name);
    } else {
        ethone.log("Thread updated: " + ctx.after.name);
    }
};

discord.on_thread_delete

Fired when a thread is deleted.

Event Context

PropertyTypeDescription
ctx.threadChannelThread channel object
ctx.guildGuildFull guild object

Example

discord.on_thread_delete = function(ctx) {
    ethone.log("Thread deleted: " + ctx.thread.name);
};

discord.on_thread_list_sync

Fired when thread member lists are synchronized.

Event Context

PropertyTypeDescription
ctx.guild_idstringGuild ID
ctx.channel_idsstring[]Array of channel IDs being synced
ctx.threadsChannel[]Array of thread objects
ctx.membersThreadMember[]Array of thread member objects
ctx.guildGuildGuild context

Example

discord.on_thread_list_sync = function(ctx) {
    ethone.log("Thread list synced: " + ctx.threads.length + " threads");
};

discord.on_thread_member_update

Fired when the current user’s thread member object is updated.

Event Context

PropertyTypeDescription
ctx.idstringThread ID
ctx.guild_idstringGuild ID
ctx.user_idstringUser ID
ctx.join_timestampstringWhen the user joined the thread
ctx.flagsnumberThread member flags
ctx.guildGuildFull guild object

Example

discord.on_thread_member_update = function(ctx) {
    ethone.log("Thread member updated in thread " + ctx.id);
};

discord.on_thread_members_update

Fired when members are added or removed from a thread.

Event Context

PropertyTypeDescription
ctx.idstringThread ID
ctx.guild_idstringGuild ID
ctx.member_countnumberApproximate member count
ctx.added_membersThreadMember[]Array of added members
ctx.removed_member_idsstring[]Array of removed member IDs
ctx.guildGuildFull guild object

Example

discord.on_thread_members_update = function(ctx) {
    ethone.log("Thread members updated");
    ethone.log("  Added: " + ctx.added_members.length);
    ethone.log("  Removed: " + ctx.removed_member_ids.length);
};

Voice Events

discord.on_voice_state_update

Fired when a user’s voice state changes (joins/leaves voice channel, mutes, deafens, etc.).

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated voice state with all properties
ctx.beforeobjectPrevious voice state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_voice_state_update = function(ctx) {
    var member = ctx.after.member;
    if (!member) return;
    
    if (ctx.before && !ctx.before.channel_id && ctx.after.channel_id) {
        ethone.log(member.username + " joined voice");
    } else if (ctx.before && ctx.before.channel_id && !ctx.after.channel_id) {
        ethone.log(member.username + " left voice");
    } else if (ctx.before && ctx.before.channel_id !== ctx.after.channel_id) {
        ethone.log(member.username + " switched voice channels");
    }
};

discord.on_voice_server_update

Fired when a voice server endpoint is updated.

Event Context

PropertyTypeDescription
ctx.tokenstringVoice connection token
ctx.guild_idstringGuild ID
ctx.endpointstringVoice server endpoint

Example

discord.on_voice_server_update = function(ctx) {
    ethone.log("Voice server updated for guild " + ctx.guild_id);
};

Typing & Presence Events

discord.on_typing_start

Fired when a user starts typing in a channel.

Event Context

PropertyTypeDescription
ctx.userAuthorFull user object
ctx.channelChannelFull channel object
ctx.guildGuildFull guild object
ctx.timestampnumberUnix timestamp

Example

discord.on_typing_start = function(ctx) {
    ethone.log(ctx.user.username + " is typing in #" + ctx.channel.name);
};
This event fires frequently. Use sparingly.

discord.on_presence_update

Fired when a user’s presence/status changes (online, offline, idle, etc.).

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated presence with user, status, activities
ctx.beforeobjectPrevious presence state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_presence_update = function(ctx) {
    if (ctx.before && ctx.before.status !== ctx.after.status) {
        ethone.log(ctx.after.user.username + ": " + ctx.before.status + " -> " + ctx.after.status);
    }
    
    if (ctx.after.activities && ctx.after.activities.length > 0) {
        ethone.log("  Playing: " + ctx.after.activities[0].name);
    }
};
This event fires frequently. Use sparingly.

discord.on_presences_replace

Fired when all presences are replaced (rare event during reconnection).

Event Context

PropertyTypeDescription
ctx.presencesPresence[]Array of presence objects

Example

discord.on_presences_replace = function(ctx) {
    ethone.log("Presences replaced: " + ctx.presences.length + " presences received");
};

User & Relationship Events

discord.on_user_update

Fired when the current user’s account is updated (username, avatar, email, etc.).

Event Context

PropertyTypeDescription
ctx.afterAuthorUpdated user object
ctx.beforeAuthorPrevious user state (if cached)

Example

discord.on_user_update = function(ctx) {
    if (ctx.before && ctx.before.username !== ctx.after.username) {
        ethone.log("Username changed: " + ctx.before.username + " -> " + ctx.after.username);
    } else {
        ethone.log("Your account was updated:");
        ethone.log("  Username: " + ctx.after.username);
    }
    
    ethone.send_event("Account Updated", "Your Discord account settings changed", "info");
};

discord.on_relationship_add

Fired when a relationship is added (friend request sent/received, friend added, blocked user, etc.).

Event Context

PropertyTypeDescription
ctx.relationship.idstringUser ID of the relationship
ctx.relationship.typenumberRelationship type (1=friend, 2=blocked, 3=incoming request, 4=outgoing request)
ctx.relationship.userAuthorUser object
ctx.relationship.sincestringISO timestamp of when relationship was created
ctx.relationship.statusstringUser’s current status

Example

discord.on_relationship_add = function(ctx) {
    var types = {1: "Friend", 2: "Blocked", 3: "Incoming Request", 4: "Outgoing Request"};
    var type = types[ctx.relationship.type] || "Unknown";
    
    ethone.log("Relationship added: " + ctx.relationship.user.username + " (" + type + ")");
};

discord.on_relationship_update

Fired when a relationship is updated (e.g., friend accepted, nickname changed, status changed).

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated relationship with id, type, user, since, status
ctx.beforeobjectPrevious relationship state (if cached)

Example

discord.on_relationship_update = function(ctx) {
    var types = {1: "Friend", 2: "Blocked", 3: "Incoming Request", 4: "Outgoing Request"};
    
    if (ctx.before && ctx.before.type !== ctx.after.type) {
        var oldType = types[ctx.before.type] || "Unknown";
        var newType = types[ctx.after.type] || "Unknown";
        ethone.log("Relationship type changed: " + ctx.after.user.username + " (" + oldType + " -> " + newType + ")");
    } else {
        ethone.log("Relationship updated with " + ctx.after.user.username);
    }
};

discord.on_relationship_remove

Fired when a relationship is removed (unfriended, unblocked, friend request cancelled/declined, etc.).

Event Context

Same structure as on_relationship_add.

Example

discord.on_relationship_remove = function(ctx) {
    ethone.log("Relationship removed: " + ctx.relationship.user.username);
};

Call Events

discord.on_call_create

Fired when a call starts in a private channel or group DM.

Event Context

PropertyTypeDescription
ctx.channel_idstringChannel ID
ctx.message_idstringCall message ID
ctx.regionstringVoice region
ctx.ringingstring[]Array of user IDs being rung
ctx.unavailablebooleanWhether the call is unavailable
ctx.channelChannelFull channel object

Example

discord.on_call_create = function(ctx) {
    ethone.log("Call started - ringing " + ctx.ringing.length + " users");
};

discord.on_call_update

Fired when a call state is updated.

Event Context

Same structure as on_call_create.

Example

discord.on_call_update = function(ctx) {
    ethone.log("Call updated - ringing " + ctx.ringing.length + " users");
};

discord.on_call_delete

Fired when a call ends.

Event Context

PropertyTypeDescription
ctx.channel_idstringChannel ID
ctx.unavailablebooleanWhether the call ended due to unavailability
ctx.channelChannelFull channel object

Example

discord.on_call_delete = function(ctx) {
    ethone.log("Call ended");
};

Invite Events

discord.on_invite_create

Fired when an invite is created.

Event Context

PropertyTypeDescription
ctx.codestringInvite code
ctx.guild_idstringGuild ID
ctx.channel_idstringChannel ID
ctx.inviterAuthorUser who created the invite
ctx.created_atstringCreation timestamp
ctx.expires_atstringExpiration timestamp
ctx.max_agenumberMax age in seconds
ctx.max_usesnumberMax number of uses
ctx.temporarybooleanWhether invite grants temporary membership
ctx.usesnumberNumber of times used
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object

Example

discord.on_invite_create = function(ctx) {
    ethone.log("Invite created: " + ctx.code);
    ethone.log("  By: " + ctx.inviter.username);
};

discord.on_invite_delete

Fired when an invite is deleted or expires.

Event Context

PropertyTypeDescription
ctx.codestringInvite code
ctx.guild_idstringGuild ID
ctx.channel_idstringChannel ID
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object

Example

discord.on_invite_delete = function(ctx) {
    ethone.log("Invite deleted: " + ctx.code);
};

Friend Suggestion Events

discord.on_friend_suggestion_create

Fired when Discord suggests a friend.

Event Context

PropertyTypeDescription
ctx.suggested_userAuthorSuggested user object
ctx.reasonsObject[]Array of suggestion reasons

Example

discord.on_friend_suggestion_create = function(ctx) {
    ethone.log("Friend suggestion: " + ctx.suggested_user.username);
};

discord.on_friend_suggestion_delete

Fired when a friend suggestion is removed.

Event Context

PropertyTypeDescription
ctx.suggested_user_idstringID of the suggested user

Example

discord.on_friend_suggestion_delete = function(ctx) {
    ethone.log("Friend suggestion removed: " + ctx.suggested_user_id);
};

Integration & Webhook Events

discord.on_integration_create

Fired when an integration is created in a guild.

Event Context

PropertyTypeDescription
ctx.idstringIntegration ID
ctx.namestringIntegration name
ctx.typestringIntegration type (twitch, youtube, discord, etc.)
ctx.enabledbooleanWhether the integration is enabled
ctx.guild_idstringGuild ID
ctx.guildGuildFull guild object

Example

discord.on_integration_create = function(ctx) {
    ethone.log("Integration created: " + ctx.name + " (" + ctx.type + ")");
};

discord.on_integration_update

Fired when an integration is updated.

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated integration object
ctx.beforeobjectPrevious integration state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_integration_update = function(ctx) {
    ethone.log("Integration updated: " + ctx.after.name);
};

discord.on_integration_delete

Fired when an integration is deleted.

Event Context

PropertyTypeDescription
ctx.idstringIntegration ID
ctx.guild_idstringGuild ID
ctx.application_idstringApplication ID (if applicable)
ctx.guildGuildFull guild object

Example

discord.on_integration_delete = function(ctx) {
    ethone.log("Integration deleted: " + ctx.id);
};

discord.on_webhooks_update

Fired when a guild’s webhooks are updated.

Event Context

PropertyTypeDescription
ctx.guild_idstringGuild ID
ctx.channel_idstringChannel ID
ctx.guildGuildFull guild object
ctx.channelChannelFull channel object

Example

discord.on_webhooks_update = function(ctx) {
    ethone.log("Webhooks updated in #" + ctx.channel.name);
};

Auto Moderation Events

discord.on_auto_moderation_rule_create

Fired when an auto moderation rule is created.

Event Context

PropertyTypeDescription
ctx.idstringRule ID
ctx.guild_idstringGuild ID
ctx.namestringRule name
ctx.creator_idstringUser who created the rule
ctx.event_typenumberEvent type
ctx.trigger_typenumberTrigger type
ctx.enabledbooleanWhether the rule is enabled
ctx.guildGuildFull guild object

Example

discord.on_auto_moderation_rule_create = function(ctx) {
    ethone.log("AutoMod rule created: " + ctx.name);
};

discord.on_auto_moderation_rule_update

Fired when an auto moderation rule is updated.

Event Context

Same structure as on_auto_moderation_rule_create.

Example

discord.on_auto_moderation_rule_update = function(ctx) {
    ethone.log("AutoMod rule updated: " + ctx.name);
};

discord.on_auto_moderation_rule_delete

Fired when an auto moderation rule is deleted.

Event Context

PropertyTypeDescription
ctx.idstringRule ID
ctx.guild_idstringGuild ID
ctx.guildGuildFull guild object

Example

discord.on_auto_moderation_rule_delete = function(ctx) {
    ethone.log("AutoMod rule deleted");
};

discord.on_auto_moderation_action_execution

Fired when an auto moderation action is executed.

Event Context

PropertyTypeDescription
ctx.guild_idstringGuild ID
ctx.actionObjectAction that was executed
ctx.rule_idstringRule ID that triggered
ctx.user_idstringUser who triggered the rule
ctx.channel_idstringChannel ID (if applicable)
ctx.message_idstringMessage ID (if applicable)
ctx.matched_keywordstringKeyword that was matched
ctx.matched_contentstringFull matched content
ctx.guildGuildFull guild object

Example

discord.on_auto_moderation_action_execution = function(ctx) {
    ethone.log("AutoMod triggered: " + ctx.matched_keyword);
};

Entitlement Events

discord.on_entitlement_create

Fired when an entitlement (subscription, premium purchase) is created.

Event Context

PropertyTypeDescription
ctx.idstringEntitlement ID
ctx.sku_idstringSKU (product) ID
ctx.application_idstringApplication ID
ctx.user_idstringUser who owns the entitlement
ctx.typenumberEntitlement type
ctx.starts_atstringStart timestamp
ctx.ends_atstringEnd timestamp

Example

discord.on_entitlement_create = function(ctx) {
    ethone.log("New entitlement: " + ctx.sku_id);
};

discord.on_entitlement_update

Fired when an entitlement is updated.

Event Context

Same structure as on_entitlement_create.

Example

discord.on_entitlement_update = function(ctx) {
    ethone.log("Entitlement updated: " + ctx.id);
};

discord.on_entitlement_delete

Fired when an entitlement is deleted.

Event Context

Same structure as on_entitlement_create.

Example

discord.on_entitlement_delete = function(ctx) {
    ethone.log("Entitlement deleted: " + ctx.id);
};

Guild Scheduled Events

discord.on_guild_scheduled_event_create

Fired when a guild scheduled event is created.

Event Context

PropertyTypeDescription
ctx.idstringEvent ID
ctx.guild_idstringGuild ID
ctx.namestringEvent name
ctx.descriptionstringEvent description
ctx.scheduled_start_timestringStart timestamp
ctx.scheduled_end_timestringEnd timestamp
ctx.creator_idstringUser who created the event
ctx.guildGuildFull guild object

Example

discord.on_guild_scheduled_event_create = function(ctx) {
    ethone.log("Scheduled event created: " + ctx.name);
};

discord.on_guild_scheduled_event_update

Fired when a guild scheduled event is updated.

Event Context

PropertyTypeDescription
ctx.afterobjectUpdated scheduled event object
ctx.beforeobjectPrevious scheduled event state (if cached)
ctx.guildGuildFull guild object

Example

discord.on_guild_scheduled_event_update = function(ctx) {
    if (ctx.before && ctx.before.name !== ctx.after.name) {
        ethone.log("Event renamed: " + ctx.before.name + " -> " + ctx.after.name);
    } else {
        ethone.log("Scheduled event updated: " + ctx.after.name);
    }
};

discord.on_guild_scheduled_event_delete

Fired when a guild scheduled event is deleted.

Event Context

Same structure as on_guild_scheduled_event_create.

Example

discord.on_guild_scheduled_event_delete = function(ctx) {
    ethone.log("Scheduled event deleted: " + ctx.name);
};

discord.on_guild_scheduled_event_user_add

Fired when a user subscribes to a guild scheduled event.

Event Context

PropertyTypeDescription
ctx.guild_scheduled_event_idstringEvent ID
ctx.user_idstringUser ID
ctx.guild_idstringGuild ID
ctx.guildGuildFull guild object

Example

discord.on_guild_scheduled_event_user_add = function(ctx) {
    ethone.log("User subscribed to event");
};

discord.on_guild_scheduled_event_user_remove

Fired when a user unsubscribes from a guild scheduled event.

Event Context

Same structure as on_guild_scheduled_event_user_add.

Example

discord.on_guild_scheduled_event_user_remove = function(ctx) {
    ethone.log("User unsubscribed from event");
};

Stage Instance Events

discord.on_stage_instance_create

Fired when a stage instance is created.

Event Context

PropertyTypeDescription
ctx.idstringStage instance ID
ctx.guild_idstringGuild ID
ctx.channel_idstringChannel ID
ctx.topicstringStage topic
ctx.privacy_levelnumberPrivacy level
ctx.guildGuildGuild context
ctx.channelChannelChannel context

Example

discord.on_stage_instance_create = function(ctx) {
    ethone.log("Stage started: " + ctx.topic);
};

discord.on_stage_instance_update

Fired when a stage instance is updated.

Event Context

Same structure as on_stage_instance_create.

Example

discord.on_stage_instance_update = function(ctx) {
    ethone.log("Stage updated: " + ctx.topic);
};

discord.on_stage_instance_delete

Fired when a stage instance is deleted.

Event Context

Same structure as on_stage_instance_create.

Example

discord.on_stage_instance_delete = function(ctx) {
    ethone.log("Stage ended");
};

Audit Log & System Events

discord.on_guild_audit_log_entry_create

Fired when a new audit log entry is created in a guild.

Event Context

PropertyTypeDescription
ctx.guild_idstringThe guild ID
ctx.entry.idstringEntry ID
ctx.entry.action_typenumberType of action performed
ctx.entry.user_idstringUser who performed the action
ctx.entry.target_idstringTarget of the action
ctx.entry.reasonstringReason for the action
ctx.guildGuildGuild context

Example

discord.on_guild_audit_log_entry_create = function(ctx) {
    ethone.log("Audit log entry created by " + ctx.entry.user_id);
};