Skip to content

Add choices support to slash command options, ephemeral support to Message - #33

Open
lmiquel wants to merge 2 commits into
cyteon:mainfrom
lmiquel:add-slash-command-choices
Open

Add choices support to slash command options, ephemeral support to Message#33
lmiquel wants to merge 2 commits into
cyteon:mainfrom
lmiquel:add-slash-command-choices

Conversation

@lmiquel

@lmiquel lmiquel commented Aug 2, 2026

Copy link
Copy Markdown

Two small, additive changes — nothing existing breaks, gleam test still green:

  • CommandOption gets a new choices: List(#(String, String)) field. When non-empty, it's serialized as the choices array Discord's API expects ([{"name": ..., "value": ...}]), turning a string/int option into a dropdown instead of free text. An empty list keeps the current behavior exactly (the choices key is omitted entirely).
  • Message gets a new ephemeral: Bool field (plus set_ephemeral), serialized as the 64 flag. Right now there's no way to send an ephemeral response or followup — useful when you want a warning visible only to the interaction's caller, e.g. alongside an already-deferred main reply.

Both came out of building a real bot: a Docker control bot where /start /stop /restart need a dropdown to pick a service, and /stop sends an ephemeral follow-up warning for certain services.

@lmiquel

lmiquel commented Aug 2, 2026

Copy link
Copy Markdown
Author

Btw, I'm very new to gleam. Lmk if I made any mistakes please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant