gaato/discord/framework does not have a README file
pub(all) suberror InteractionContextError {
MissingInvoker
MissingGuildMemberUser
MissingGuildId
MissingComponentMessage
} derive(Debug)pub(all) suberror ResponseGateError {
AlreadyResponded
Expired
InvalidCallback(kind~ : InteractionType, typ~ : InteractionResponseType)
} derive(Debug)pub(all) struct AutocompleteCtx {
client : Client
application_id : Id[ApplicationMarker]
interaction : Interaction
data : CommandData
options : CommandOptions
// private fields
}async fn AutocompleteCtx::suggest(self : AutocompleteCtx, choices : Array[CommandOptionChoice]) -> Unitpub(all) struct CommandCtx {
client : Client
application_id : Id[ApplicationMarker]
interaction : Interaction
data : CommandData
options : CommandOptions
// private fields
}async fn CommandCtx::edit_followup(self : CommandCtx, message_id : Id[MessageMarker], content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest]) -> Messageasync fn CommandCtx::edit_response(self : CommandCtx, content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest], poll? : PollCreateRequest) -> Messageasync fn CommandCtx::followup(self : CommandCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, poll? : PollCreateRequest, ephemeral? : Bool) -> Messageasync fn CommandCtx::respond(self : CommandCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, ephemeral? : Bool) -> Unitasync fn CommandCtx::show_modal(self : CommandCtx, custom_id~ : String, title~ : String, components~ : Array[Component]) -> Unitpub(all) struct ComponentCtx {
client : Client
application_id : Id[ApplicationMarker]
interaction : Interaction
data : ComponentData
// private fields
}async fn ComponentCtx::edit_followup(self : ComponentCtx, message_id : Id[MessageMarker], content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest]) -> Messageasync fn ComponentCtx::edit_response(self : ComponentCtx, content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest], poll? : PollCreateRequest) -> Messageasync fn ComponentCtx::followup(self : ComponentCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, poll? : PollCreateRequest, ephemeral? : Bool) -> Messageasync fn ComponentCtx::respond(self : ComponentCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, ephemeral? : Bool) -> Unitasync fn ComponentCtx::show_modal(self : ComponentCtx, custom_id~ : String, title~ : String, components~ : Array[Component]) -> Unitasync fn ComponentCtx::update_message(self : ComponentCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions) -> Unitpub struct Framework {
// private fields
}fn Framework::autocomplete(self : Framework, command_name : String, handler : async (AutocompleteCtx) -> Unit) -> Frameworkfn Framework::command(self : Framework, spec : CommandSpec, handler : async (CommandCtx) -> Unit) -> Frameworkfn Framework::component(self : Framework, prefix : String, handler : async (ComponentCtx) -> Unit) -> Frameworkfn Framework::component_id(self : Framework, id : String, handler : async (ComponentCtx) -> Unit) -> Frameworkasync fn Framework::process_with(self : Framework, interaction : Interaction, gate~ : ResponseGate) -> Boolasync fn Framework::sync_guild(self : Framework, guild_id : Id[GuildMarker], unowned? : UnownedCommands) -> ScopeSyncReportasync fn Framework::wait_for_component(self : Framework, custom_id~ : String, user? : Id[UserMarker], timeout_ms? : Int) -> ComponentCtx?pub(all) struct ModalCtx {
client : Client
application_id : Id[ApplicationMarker]
interaction : Interaction
data : ModalData
// private fields
}async fn ModalCtx::edit_followup(self : ModalCtx, message_id : Id[MessageMarker], content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest]) -> Messageasync fn ModalCtx::edit_response(self : ModalCtx, content? : String, clear_content? : Bool, embeds? : Array[Embed], components? : Array[Component], allowed_mentions? : AllowedMentions, files? : Array[FileUpload], keep_attachments? : Array[AttachmentRequest], poll? : PollCreateRequest) -> Messageasync fn ModalCtx::followup(self : ModalCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, poll? : PollCreateRequest, ephemeral? : Bool) -> Messageasync fn ModalCtx::respond(self : ModalCtx, content? : String, embeds? : Array[Embed], components? : Array[Component], files? : Array[FileUpload], allowed_mentions? : AllowedMentions, ephemeral? : Bool) -> Unitpub struct ResponseCapture {
// private fields
}pub struct ResponseGate {
// private fields
}fn ResponseGate::ResponseGate(kind : InteractionType, sink : async (InteractionResponse, Array[FileUpload]?) -> Unit, rejected? : (Error) -> Bool) -> ResponseGatetest "expire an unused callback window" {
let gate = @framework.ResponseGate(ApplicationCommand, (_, _) => ())
assert_eq(gate.state(), Pending)
gate.expire()
assert_eq(gate.state(), Expired)
assert_true(gate.responded())
}async fn ResponseGate::send(self : ResponseGate, response : InteractionResponse, files? : Array[FileUpload]) -> Unitpub(all) enum ResponseState {
Pending
Sent(InteractionResponseType)
Unconfirmed(InteractionResponseType)
Expired
} derive(Eq, Debug)fn plan_command_sync(declared : Array[CommandSpec], fetched : Array[Json], unowned~ : UnownedCommands, guild_id? : Id[GuildMarker]) -> (Json?, ScopeSyncReport)test {
let (payload, report) = @framework.plan_command_sync([], [], unowned=Keep)
assert_true(payload is None)
assert_false(report.overwritten)
}async fn sync_command_scope(client : Client, application_id : Id[ApplicationMarker], declared : Array[CommandSpec], unowned? : UnownedCommands, guild_id? : Id[GuildMarker]) -> ScopeSyncReportInstall
Download zipAn experimental Discord library for MoonBit: native/JS/Wasm REST, interactions, and gateway bots; native voice with DAVE E2EE.
Dependencies