Module SlashCreate.CommandContext

type channel;
type role;
type t = pri {
creator: SlashCreator.t,

The creator of the command.

interactionToken: string,

The interaction's token.

interactionID: string,

The interaction's ID.

channelID: string,

The channel ID that the command was invoked in.

guildID: Js.undefined(string),

The guild ID that the command was invoked in.

member: Member.unresolved,

The member that invoked the command.

user: User.t,

The user that invoked the command.

commandName: string,

The command's name.

commandID: string,

The command's ID.

options: Js.Json.t,

The options given to the command.

subcommands: array(string),

The subcommands the member used in order.

invokedAt: float,

The time when the context was created.

mutable initiallyResponded: bool,

Whether the initial response was made.

users: Js.Dict.t(User.t),

The resolved users of the interaction.

members: Js.Dict.t(Member.t),

The resolved members of the interaction.

roles: Js.Dict.t(role),

The resolved roles of the interaction.

channels: Js.Dict.t(channel),

The resolved channels of the interaction.

expired: bool,

Whether the interaction has expired. Interactions last 15 minutes.

};
let acknowledge: t => ?⁠includeSource:bool => unit => Js.Promise.t(bool);

Acknowleges the interaction. Including source will send a message showing only the source.

parameter includeSource

Whether to include the source in the acknowledgement

let delete: t => ?⁠messageID:string => unit => Js.Promise.t(unit);

Deletes a message. If the message ID was not defined, the original message is used.

parameter messageID

The message's ID

let edit: t => messageID:string => [ `Content(string) | `Params(Message.editParams) ] => Js.Promise.t(Message.t);

Edits a message.

parameter self

The context within which to send the message

parameter messageID

The message's ID

parameter options

The message content, or a structure of message options

let editOriginal: t => [ `Content(string) | `Params(Message.editParams) ] => Js.Promise.t(Message.t);

Edits the original message. This is put on a timeout of 150 ms for webservers to account for Discord recieving and processing the original response.

Note: This will error with ephemeral messages or acknowledgements.

parameter self

The context within which to edit the message

parameter options

The message content, or a structure of message options

let _send: t => [ `Content(string) | `Params(Message.params) ] => Js.Promise.t(Js.Json.t);
let assertIsMessage: Js.Dict.t(Js.Json.t) => Message.t;
let send: t => [ `Content(string) | `Params(Message.params) ] => Js.Promise.t([ `Initial(bool) | `Message(Message.t) ]);

Sends a message, if it already made an initial response, this will create a follow-up message. This will return a boolean if it's an initial response, otherwise a Message.t will be returned.

Note that when making a follow-up message, the Message.params.ephemeral and Message.params.includeSource are ignored.

parameter self

The context within which to send the message

parameter options

The message content, or a structure of message options

let sendFollowUp: t => [ `Content(string) | `Params(Message.followUpParams) ] => Js.Promise.t(Message.t);

Sends a follow-up message.

parameter self

The context within which to send the message

parameter options

The message content, or a structure of message options