1.5 KiB
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 ping → pong only if you enable Message Content Intent in the Developer Portal and check the box on this page.
Prerequisites
- Install the BridgeSwarm extension and native host.
- Control Center → Settings → Enable Discord.
- 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
- Paste the bot token (kept in this tab only).
- Optionally paste a guild id so
/pingregisters immediately. - Click Login. Watch the log for
Logged in as …. - 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.js —
new Client, slash registration, ping/pong - style.css — Layout