83 lines
6.6 KiB
JSON
83 lines
6.6 KiB
JSON
{
|
|
"name": "discord-bot",
|
|
"section": 1,
|
|
"title": "discord-bot",
|
|
"synopsis": [
|
|
"discord-bot [--env PATH] [--token TOKEN] [--guild ID] [--check] [--debug] [--message-content] [--login-timeout MS] [--no-user-install]"
|
|
],
|
|
"description": "Bare OS Discord bot via ctx.bare.discordJS. Commands run as the unlocked session user (not guest). /r requires cmd and is a non-interactive shell (cwd, history, autocomplete). /upload attaches a file and wget-saves it into the /r cwd or a given path. /open-file path reads a VFS file and posts it as a Discord attachment (uploaded to the Discord CDN; the message is not auto-deleted after idle). /hdms manages extra Hyperdrives (list, create, add, invite, pair, health) via ctx.runHdms. /holesail manages persisted Holesail tunnels and the bare-holesail unit (list, add, edit, start/stop, enable/disable, service, url) via ctx.bareOsRunHolesailCli; show never prints seed material. /agent is the full guest /bin/agent harness when ~/.agent/config.json is ready (QVAC + host bridge, or REST + API key + base URL): ask (required prompt; new/plan/auto/compact/max_turns/model), status, config, models, skills, todos, plan, hooks, history, recap, undo, rewind, compact, export, remember, reset, stop. History, skills, todos, and MEMORY.md are shared with the TTY; API keys are never shown. Whitelisted users can Direct Message the bot to talk to the agent without a slash command (same ~/.agent session; help / reset / stop as text). The first allowed DM opens a persistent message channel (~/.discord/channel.json). The agent can then reach out anytime with discord_send_message (live send via ctx.bareOsDiscordSendDm, or queue ~/.discord/outbox.json until the bot drains it). Inbound copies land in ~/.discord/inbox.json. Empty DISCORD_ID_WHITELIST denies every DM, inbound and outbound. /status sets the bot presence shown in the member list (playing, watching, listening, competing, custom, streaming plus online/idle/dnd/invisible); persisted as DISCORD_STATUS / DISCORD_ACTIVITY_TYPE / DISCORD_ACTIVITY_NAME in ~/.discord/.env and also under /settings Discord. /plugins loads JSON or JS from ~/.discord/plugins (see developer-guide ch.21). Also /settings, /files, /open-file, /panel, /edit, /create, /bare, /sys, /svc, /fs, /net, /man, /say, /journal, /ping. Embeds paginate when large and expire after 2 minutes idle; /open-file attachments stay. Token from --token, DISCORD_TOKEN, or ~/.discord/.env. User-installable (Add App to your Discord profile) is on by default so slash commands work in DMs and any server; DISCORD_ID_WHITELIST is always enforced on those surfaces (empty list denies user-install / DM use). DirectMessages intent is requested so DM chat works without the privileged Message Content Intent. The initd unit bare-os-discord is listed by systemctl only when ~/.discord/.env exists.",
|
|
"options": [
|
|
{
|
|
"flag": "--env PATH",
|
|
"meaning": "VFS path to a .env file containing DISCORD_TOKEN=... (also --env-file)."
|
|
},
|
|
{
|
|
"flag": "--token TOKEN",
|
|
"meaning": "Bot token (Developer Portal → Bot → Token). Prefer a .env file."
|
|
},
|
|
{
|
|
"flag": "--guild ID",
|
|
"meaning": "Guild id for instant /ping registration (else global, up to ~1 hour)."
|
|
},
|
|
{
|
|
"flag": "--check",
|
|
"meaning": "Verify ctx.bare.discordJS and that a token can be resolved; do not login."
|
|
},
|
|
{
|
|
"flag": "--debug",
|
|
"meaning": "Print discord.js debug lines (also DISCORD_DEBUG=1)."
|
|
},
|
|
{
|
|
"flag": "--message-content",
|
|
"meaning": "Request the privileged Message Content Intent so channel 'ping' replies pong. Enable the same intent in the Developer Portal first."
|
|
},
|
|
{
|
|
"flag": "--login-timeout MS",
|
|
"meaning": "Fail login if the gateway is not ready after MS milliseconds (default 45000)."
|
|
},
|
|
{
|
|
"flag": "--no-user-install",
|
|
"meaning": "Guild-only bot. Do not register user-install (profile app) commands. Same as DISCORD_USER_INSTALL=0."
|
|
}
|
|
],
|
|
"keywords": ["discord", "bot", "ping", "pong", "ctx.bare"],
|
|
"environment": [
|
|
"DISCORD_TOKEN — bot token in the guest session (also copied from the host when set).",
|
|
"DISCORD_ENV_FILE / BARE_OS_DISCORD_ENV_FILE — path to a .env file. On the host this may be a host filesystem path (booter reads it). In the guest it is a VFS path. Preferred guest path: ~/.discord/.env.",
|
|
"BARE_OS_DISCORD_INITD — set 0 / false to never register the bare-os-discord systemctl unit, even when ~/.discord/.env exists.",
|
|
"DISCORD_GUILD_ID — optional guild for slash-command registration.",
|
|
"DISCORD_ID_WHITELIST — comma-separated Discord user ids allowed to use the bot (slash, autocomplete, buttons, selects, modals, channel ping, and Direct Messages). Read from the session, ~/.discord/.env, ~/.discord.env, ~/discord.env, ~/.env, and ./.env. Unset or empty still allows guild-installed commands in a server, but user-install / DM / private-channel use is always denied. A user not on a non-empty list is denied (ephemeral reply, or a DM deny text) in every install context.",
|
|
"DISCORD_USER_INSTALL / BARE_OS_DISCORD_USER_INSTALL — user-installable profile app (default on). Set 0 / false / off for a guild-only bot.",
|
|
"DISCORD_STATUS — presence: online, idle, dnd, or invisible (member list). Default online.",
|
|
"DISCORD_ACTIVITY_TYPE — playing, watching, listening, competing, custom, or streaming. Default playing.",
|
|
"DISCORD_ACTIVITY_NAME — activity text (default Bare OS). Set off / none / - to clear.",
|
|
"DISCORD_ACTIVITY_URL — optional streaming URL when activity type is streaming.",
|
|
"DISCORD_MESSAGE_CONTENT / BARE_OS_DISCORD_MESSAGE_CONTENT — set 1 to request Message Content Intent (same as --message-content).",
|
|
"DISCORD_DEBUG / BARE_OS_DISCORD_DEBUG — set 1 to print discord.js debug lines.",
|
|
"DISCORD_LOGIN_TIMEOUT_MS — login deadline in milliseconds (default 45000).",
|
|
"BARE_OS_DISCORD — set 0 / false to skip loading ctx.bare.discordJS.",
|
|
"BARE_OS_BARE_MODULES — set 0 to omit ctx.bare entirely."
|
|
],
|
|
"seeAlso": [
|
|
{
|
|
"name": "bare-os-ctx-bare",
|
|
"section": 7
|
|
},
|
|
{
|
|
"name": "devguide-21-discord-bots",
|
|
"section": 7
|
|
}
|
|
],
|
|
"bareOsNotes": "Requires a Bare/Pear host so vendored bare-discord-js can remap Node builtins. Guest scripts have no import/require; use ctx.bare.discordJS.",
|
|
"examples": [
|
|
{
|
|
"caption": "check token resolution without connecting",
|
|
"code": "discord-bot --check --env ~/.discord/.env"
|
|
},
|
|
{
|
|
"caption": "run the ping-pong bot",
|
|
"code": "discord-bot --env ~/.discord/.env --guild 123456789012345678"
|
|
}
|
|
]
|
|
}
|