Tutorial on how to use this repo: https://docs.kindroid.ai/official-discord-bot-integration
A Node.js service that manages multiple Discord bots, each tied to a unique Kindroid AI persona. The system uses just-in-time message fetching to provide conversation context without storing large message logs.
- Multi-bot support: Run multiple Discord bots from a single service
- Kindroid AI integration: Each bot is tied to a unique AI persona (via
SHARED_AI_CODE_n) - JIT message fetching: Dynamically grabs the last ~30 messages for context
- Caching: Minimizes redundant Discord API calls
- Graceful shutdown: Bots disconnect on SIGINT/SIGTERM
- Configurable NSFW filtering via environment variables
- Node.js 16.x or higher
- Discord Bot Token(s) from the Discord Developer Portal
- Kindroid AI API access (API key and share code)
-
Clone the repository:
git clone https://github.com/KindroidAI/Kindroid-discord.git cd Kindroid-discord -
Install dependencies:
npm install
-
Copy and configure .env:
cp .env.example .env
-
Fill in your KINDROID_API_KEY, KINDROID_INFER_URL, and bot tokens (BOT_TOKEN_n). Provide SHARED_AI_CODE_n for each bot's AI persona.
-
Run in development mode:
npm run dev
For production:
npm run build npm start
Use environment variables to configure your bots. The .env.example file shows usage:
- KINDROID_INFER_URL: The Kindroid AI API endpoint, and should not change
- KINDROID_API_KEY: Your Kindroid AI API key
- SHARED_AI_CODE_n: The share code to identify which AI persona to use for the n-th bot
- BOT_TOKEN_n: Discord bot token for the n-th bot
- ENABLE_FILTER_n: (Optional) true or false to enable NSFW filtering for the n-th bot
You can create as many bots as you want by incrementing the number (_1, _2, _3, etc.).
- Failed bot initialization is logged; other bots still initialize
- Conversation fetch failures are caught and logged
- API call errors log diagnostic info and return a friendly user message
- SIGINT or SIGTERM triggers a graceful shutdown of all bots
- Fork this repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License.