Skip to content

Defined in: sdk/js/src/context.ts:24

Passed to every event listener.

new EventContext(me): EventContext

Defined in: sdk/js/src/context.ts:25

Me

EventContext

delete(message): void

Defined in: sdk/js/src/context.ts:43

Deletes message (the bot’s own, or any with MANAGE_MESSAGES).

Message

void


dm(memberId, payload): object

Defined in: sdk/js/src/context.ts:48

Sends a direct message to memberId (capability dms), opening the DM when needed.

string

MessagePayload

object

channelId: string

messageId: string


isMe(memberId): boolean

Defined in: sdk/js/src/context.ts:64

Whether memberId is the bot itself (known once ready arrived).

string

boolean


mentionsMe(message): boolean

Defined in: sdk/js/src/context.ts:73

Whether message mentions the bot: by its member id, by @everyone, or by one of its roles. Only when the message names roles does it ask the host for the bot’s own roles (community.getMember); a refusal there counts as not mentioned.

Message

boolean


react(message, emoji): void

Defined in: sdk/js/src/context.ts:38

Adds a reaction to message.

Message

string

void


reply(message, payload): string

Defined in: sdk/js/src/context.ts:33

Replies to message in its channel.

Message

MessagePayload

string


send(channelId, payload): string

Defined in: sdk/js/src/context.ts:28

Posts in channelId; returns the new message’s id.

string

MessagePayload

string


setPresence(status, activity?): void

Defined in: sdk/js/src/context.ts:54

Sets the bot’s status and activity (none: no activity).

PresenceStatus

Activity

void


setStatusText(text): void

Defined in: sdk/js/src/context.ts:59

Sets the bot’s custom status text, kept until changed.

string

void