A powerful Discord bot integrating Gemini AI and OpenAI Assistant for community support, news sharing, and engagement.
This Discord bot is built using Python and integrates AI capabilities from Google's Gemini API. It also supports OpenAI Assistant as an alternative AI backend. The bot is designed to provide community support, share news, and enhance engagement within Discord communities, with specific optimizations for blockchain/Polkadot-related discussions.
-
Community Question Support
- Provide accurate and prompt answers to technical and non-technical questions related to:
- Polkadot's architecture, parachains, XCM, staking, and governance
- General blockchain concepts, use cases, and emerging trends
- Assist developers with queries about Polkadot development tools, APIs, and SDKs
- Provide accurate and prompt answers to technical and non-technical questions related to:
-
News Sharing
- Aggregate and share the latest Polkadot ecosystem updates
- Notify the community about important events (runtime upgrades, governance proposals, parachain launches)
- Highlight key milestones and success stories within the Polkadot ecosystem
-
Community Engagement
- Respond to frequently asked questions (FAQs)
- Guide members to appropriate resources or documentation
- Promote healthy discussions and foster collaboration among members
-
Advanced Capabilities
- PDF content analysis and summarization
- YouTube video summarization
- Blog updates tracking
- Repository monitoring
- FAQ database maintenance and updates
-
src/
: Core logic of the botbot/
: Fundamental logic for AI interaction and chatbot responses- Message processing
- AI response formatting
- Documentation handling
urls/
: Contains URLs for Blogs, FAQs, and Repositoriesmain.py
: Application entry point
-
crawl.py
: Web crawler for FAQ database population -
Dockerfile
: Container configuration for Docker deployment -
start.py
: Deployment script for Railway and local testing
- Python 3.8+
- Discord Bot Token
- Google AI API Key (for Gemini)
- OpenAI API Key (optional, for Assistant backend)
- GitHub Token (for repository tracking)
- Clone the repository
git clone [email protected]:Hpgbao2204/builder-support-agent.git
cd builder-support-agent
- Install dependencies
pip install -r requirements.txt
Create a .env
file in the project root with the following variables:
GOOGLE_AI_KEY=your_google_ai_key
DISCORD_BOT_TOKEN=your_discord_bot_token
MAX_HISTORY=10 # Number of messages to store in conversation history
GITHUB=your_github_token
# Optional: OPENAI_API_KEY=your_openai_api_key
Start the bot
python start.py
Docker deployment
docker build -t gemini-discord-bot .
docker run -d --env-file .env gemini-discord-bot
Railway deployment
Configure your Railway project to use the repository and set the environment variables.
The bot's AI capabilities follow a structured process:
-
Query Processing
- Captures user messages in Discord
- Analyzes intent and context using NLP
-
Information Retrieval & Response Generation
- Checks FAQ database and documentation first
- Generates AI-driven responses using Gemini or OpenAI
- Fetches external data via APIs and web scraping when needed
- Provides optimized answers with contextual awareness
- Analysis of PDFs and YouTube content
-
Continuous Learning
- Maintains conversation context
- Logs interactions for performance improvement
- Updates knowledge bases from configured sources
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the 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
[Insert your license information here]