Skip to content

KindroidAI/Kindroid-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kindroid Discord Multi-Bot Manager

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.

Features

  • 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

Prerequisites

  • Node.js 16.x or higher
  • Discord Bot Token(s) from the Discord Developer Portal
  • Kindroid AI API access (API key and share code)

Setup

  1. Clone the repository:

    git clone https://github.com/KindroidAI/Kindroid-discord.git
    cd Kindroid-discord
  2. Install dependencies:

    npm install
  3. Copy and configure .env:

    cp .env.example .env
  4. 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.

  5. Run in development mode:

    npm run dev

    For production:

    npm run build
    npm start

Configuration

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.).

Error Handling

  • 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

Contributing

  1. Fork this repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors