AI Developer assistant for Discord communities.
Soma is a Discord bot that answers questions and helps with coding tasks in group chats and private DMs. It remembers conversations for 24 hours and can search the web when needed.
You can talk to it three ways:
- Use
/soma <question>in any channel - Right-click a message and select "Ask Soma"
- Right-click and select "Ask Soma with Context" for detailed help
Want to try Soma without hosting it yourself? Add our hosted version to your Discord server or Apps:
You can use Soma in:
- Server channels
- Group chats
- Private DMs
Or host your own instance below.
You: /soma why is this throwing a null reference error?
[paste your code]
Soma: You're calling .map() on userData before checking if it exists.
Add a null check first: if (!userData) return null;
You: [right-click on a code snippet] → Ask Soma with Context
Context: "how can we make this faster?"
Soma: This loops through the array twice. You can combine the filter
and map into a single pass with reduce, cutting the time in half.
Friend: "React hooks came out in 2016"
You: [right-click message] → Ask Soma
Soma: React Hooks were released in February 2019 with React 16.8,
not 2016.
You: /soma what's the actual difference between a burrito and a wrap?
Soma: A burrito uses a flour tortilla and is fully closed on both ends.
A wrap can use any flatbread and is usually open on one or both ends.
But honestly, the line gets blurry at Chipotle.
You'll need:
- Node.js v18 or higher
- Bun or npm
- A Cloudflare account
- A Discord application
git clone https://github.com/pasomadev/soma-app.git
cd soma-app
bun installCopy .dev.vars.example to .dev.vars and add your keys:
DISCORD_APPLICATION_ID=your_discord_app_id
DISCORD_PUBLIC_KEY=your_discord_public_key
DISCORD_TOKEN=your_discord_bot_token
GEMINI_API_KEY=your_google_gemini_api_keybun run reg # register commands
bun run dev # start local server
bun run deploy # push to cloudflareDiscord sends requests to Cloudflare Workers, which talks to Google Gemini and stores chat history in Cloudflare KV.
src/
├── index.ts # main bot logic
├── llm.ts # gemini integration
├── utils.ts # chat history helpers
├── types.ts # type definitions
├── contants.ts # system prompts
└── register.ts # command registration
- Cloudflare Workers for hosting
- Hono and discord-hono for the framework
- Google Gemini Flash 2.5
- Vercel AI SDK
- TypeScript and Bun
Fork the repo, make your changes, and open a pull request. Run bun test before committing.
- Support for multiple AI models
- Custom prompts per server
- Voice message support
- Image analysis
- Deepwiki MCP
Commands don't show up: Discord takes up to an hour to sync global commands. Try in a different server.
Bot doesn't respond: Check your environment variables and make sure the bot has the right Discord permissions.
Slow responses: First requests take longer. After that it's fast.
MIT - see LICENSE file.