← BACK

parceltongueBOT

JavaScript ⭐ 1

p4rs3lt0ng Discord Bot (Cloudflare Workers)

Discord bot built on your p4rs3lt0ngv3 site logic, running as a Cloudflare Worker using Discord Interactions webhooks.

Commands

Command What it does
/setup apikey Save your OpenRouter API key (ephemeral, only you see it)
/setup model Pick your default AI model from a dropdown
/setup syntax Set a default system prompt applied to every /ask
/setup status View your current saved settings
/ask prompt: Generate text using your saved model + key
/ask prompt: model: system: Override model/system prompt per request
/models List all available models by provider
/endseq Show common end-sequence / delimiter probes
/encode text: method: Encode with Base64, Hex, Binary, Morse, Caesar, etc.
/decode text: Auto-detect and decode any encoding
/decode text: method: Decode with a specific method
/gibberish generate text: Convert text to consistent gibberish
/gibberish remove text: Generate random letter-removal variations
/gibberish strip text: chars: Remove specific characters

Setup

1. Create Discord App + Interaction URL

  1. Go to https://discord.com/developers/applications
  2. New Application → give it a name
  3. General Information → copy the Public Key
  4. Bot tab → Reset Token → copy it
  5. OAuth2 → URL Generator → select bot + applications.commands
  6. Open the URL → add bot to your server

2. Configure Cloudflare Worker

cd p4rs3lt0ng-discord-bot
npm install

Edit wrangler.toml:

  • Set DISCORD_PUBLIC_KEY
  • Fill in kv_namespaces IDs

Create secrets:

npx wrangler secret put DISCORD_BOT_TOKEN
npx wrangler secret put DISCORD_APP_ID

Optional (guild-only command registration):

npx wrangler secret put GUILD_ID

3. Register Slash Commands

npm run register

4. Deploy

npm run deploy

After deploy, copy your Worker URL into Interaction Endpoint URL in the Discord app settings.

File Structure

p4rs3lt0ng-discord-bot/
├── src/
│   └── worker.js               # Cloudflare Worker entry point
├── commands/                   # Interaction handlers
├── utils/                      # Shared helpers (OpenRouter, KV store, transforms)
├── data/                       # Static data
├── scripts/
│   └── register-commands.js    # Registers slash commands
├── wrangler.toml               # Cloudflare Workers config
└── package.json

Adding More Tools

Each file in commands/ is an interaction handler. To add a new command:

  1. Create commands/yourtool.js
  2. Export a handler and register it in src/worker.js
  3. Update scripts/register-commands.js and re-run npm run register

Expanding from Your Site

To port more tools from your site's js/tools/:

  • Extract the logic from getVueMethods() into a plain function in utils/
  • Import it in a new command file
  • The Vue-specific stuff (this.showNotification, this.copyToClipboard) just becomes Discord replies