discord-cli

    Discord REST CLI for coding agents: read guilds, channels and messages, send messages, and call raw routes with a bot token. Built on gaato/discord.

    discord
    cli
    skill
    agent
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    192

    #discord-cli

    A native MoonBit CLI for Discord's bot REST API, with an agent skill in SKILL.md. Reads identity, guilds, channels and messages, sends messages, and supports custom REST routes.

    #Run

    With MoonBit's moonx, a native C toolchain, and Node on PATH (required by the Discord dependency's prebuild hook), moonx downloads and runs the module:

    # Supply DISCORD_TOKEN through your environment or secret manager. moonx gaato/discord-cli --help moonx gaato/discord-cli me moonx gaato/discord-cli guilds moonx gaato/discord-cli channels 123456789012345678 moonx gaato/discord-cli messages 234567890123456789 --limit 10 moonx gaato/discord-cli send 234567890123456789 'Hello' moonx gaato/discord-cli api GET /users/@me

    DISCORD_TOKEN must be a bot token. Posting requires the user's explicit request and appropriate bot permissions. Each successful data command prints one pretty JSON document. Errors use stderr; exit codes are 0 (success/help), 1 (runtime/API failure), and 2 (usage/input/token missing).

    OptionApplies toMeaning
    --token TOKENAll commandsOverrides DISCORD_TOKEN; prefer the environment to avoid exposing arguments
    --help, -hAll commandsUsage text
    --versionRootVersion text
    --limit N, -n Nmessages CHANNEL_IDPositive 32-bit integer; default 50; paginates beyond 100
    --before ID / --after IDmessages CHANNEL_IDExclusive cursors; cannot combine
    --stdinsend CHANNEL_ID [text...]Read UTF-8 input, overriding text arguments
    --reply-to IDsend CHANNEL_ID [text...]Reply to a message
    --body JSON, -d JSONapi METHOD PATHJSON body; path relative to /api/v10

    IDs are unsigned 64-bit decimal strings. Messages are sorted newest first; --after fetches forward from its cursor. guilds fetches every page. See the skill for output fields, write guidance, and rate-limit handling.

    #Develop

    Use moon on PATH with the version pinned in moonbit-version. Dependencies are declared in moon.mod. Only native is supported because the pinned moonbitlang/async library has no wasm backend.

    moon fmt moon info moon check --target native moon test --target native moon build --target native moon run --target native . -- --help

    Tests run offline, including simulated REST success and 401 responses. The root package is the only executable. Licensed under Apache-2.0.

    UsageError

    type UsageError

    Command

    type Command