EventContext
Defined in: sdk/js/src/context.ts:24
Passed to every event listener.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventContext(
me):EventContext
Defined in: sdk/js/src/context.ts:25
Parameters
Section titled “Parameters”Returns
Section titled “Returns”EventContext
Methods
Section titled “Methods”delete()
Section titled “delete()”delete(
message):void
Defined in: sdk/js/src/context.ts:43
Deletes message (the bot’s own, or any with MANAGE_MESSAGES).
Parameters
Section titled “Parameters”message
Section titled “message”Message
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”memberId
Section titled “memberId”string
payload
Section titled “payload”Returns
Section titled “Returns”object
channelId
Section titled “channelId”channelId:
string
messageId
Section titled “messageId”messageId:
string
isMe()
Section titled “isMe()”isMe(
memberId):boolean
Defined in: sdk/js/src/context.ts:64
Whether memberId is the bot itself (known once ready arrived).
Parameters
Section titled “Parameters”memberId
Section titled “memberId”string
Returns
Section titled “Returns”boolean
mentionsMe()
Section titled “mentionsMe()”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.
Parameters
Section titled “Parameters”message
Section titled “message”Message
Returns
Section titled “Returns”boolean
react()
Section titled “react()”react(
message,emoji):void
Defined in: sdk/js/src/context.ts:38
Adds a reaction to message.
Parameters
Section titled “Parameters”message
Section titled “message”Message
string
Returns
Section titled “Returns”void
reply()
Section titled “reply()”reply(
message,payload):string
Defined in: sdk/js/src/context.ts:33
Replies to message in its channel.
Parameters
Section titled “Parameters”message
Section titled “message”Message
payload
Section titled “payload”Returns
Section titled “Returns”string
send()
Section titled “send()”send(
channelId,payload):string
Defined in: sdk/js/src/context.ts:28
Posts in channelId; returns the new message’s id.
Parameters
Section titled “Parameters”channelId
Section titled “channelId”string
payload
Section titled “payload”Returns
Section titled “Returns”string
setPresence()
Section titled “setPresence()”setPresence(
status,activity?):void
Defined in: sdk/js/src/context.ts:54
Sets the bot’s status and activity (none: no activity).
Parameters
Section titled “Parameters”status
Section titled “status”activity?
Section titled “activity?”Returns
Section titled “Returns”void
setStatusText()
Section titled “setStatusText()”setStatusText(
text):void
Defined in: sdk/js/src/context.ts:59
Sets the bot’s custom status text, kept until changed.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void