Files
BridgeSwarm/examples/discord-bot/README.md
T
snxraven 693814f46b
CI / Build & Test (push) Failing after 52s
Add Discordjs
2026-09-04 22:10:35 -04:00

1.5 KiB

Discord Bot — BridgeSwarm.DiscordJS

What this example does

Runs an official discord.js 14 bot from the page. The real Client lives in the Bare native host (bare-discord-js); the page uses BridgeSwarm.DiscordJS (Client, GatewayIntentBits, Events, SlashCommandBuilder, REST, Routes).

/ping replies pong. Channel text pingpong only if you enable Message Content Intent in the Developer Portal and check the box on this page.

Prerequisites

  1. Install the BridgeSwarm extension and native host.
  2. Control Center → Settings → Enable Discord.
  3. Create a Discord application → Bot → Reset Token. Copy the bot token (not the OAuth2 client secret).

How to run

Recommended: Extension Settings → enable Examples server, then open the demo URL below.

Dev alternative from the repo root:

npm run examples

Open http://127.0.0.1:4173/discord-bot/. Do not use file://.

Usage

  1. Paste the bot token (kept in this tab only).
  2. Optionally paste a guild id so /ping registers immediately.
  3. Click Login. Watch the log for Logged in as ….
  4. In Discord, run /ping. Click Destroy when finished.

See docs/DISCORD.md for the API, the cache fidelity gap, and packing notes.

Files in this directory

  • index.html — Token / guild / login UI
  • app.jsnew Client, slash registration, ping/pong
  • style.css — Layout