An AI-powered Discord bot to boost participation, motivation, and collaboration in remote GitHub teams using gamification. Default model is gemini-2.5-flash but can adjust.
Key Features:
- Gamification: Earn points (10/commit, 20/issue, 30/PR) and badges (when points > 100/500/1000 → Bronze/Silver/Gold Collaborator).
- AI Challenges: Personalized suggestions like "Review one PR to share your expertise" via Gemini AI.
- Sentiment Analysis: Analyze message tone for healthy communication.
- Leaderboard: Real-time ranking of top contributors.
- Polling: Automatic updates every 5 minutes.
- Commands:
!set_repo,!link_github,!my_challenge,!leaderboard,!sentiment <message_id>,!update_stats,!shutdown - Architecture: Discord input → GitHub API fetch → Data processing → Gemini AI → Output/Leaderboard.
Screen.Recording.2025-12-02.at.19.32.36.mov
see .env.example. If you already have all 3 APIs, Jump to see 2. New Terminal Installation
- Go to the Discord Developer Portal.
- Create a new application, name it (e.g., "GitHubDiscordBot").
- In the "Bot" left tab, add a bot and copy the token.
- Enable "Message Content" intent in the bot settings.
- Invite the bot to your server using the OAuth2 URL generator (select bot permissions like "Send Messages" and "Read Message History").
- Why personal? Discord tokens are tied to your account; sharing violates terms and risks bans.
- Free; no costs.
-
If want to save time: Here is the Example Bot Installation
-
Example Bot Token: you need to send me the request!
-
For your own Bot Token: Install the discord bot through the Install Link in the "Installation" left tab.
- Log into GitHub, go to Settings > Developer settings > Personal access tokens > Tokens (classic).
- Generate a new token with scopes: repo (full access for commits/issues/PRs), read:user (for user data).
- Copy the token (it starts with ghp_ or github_pat_).
- Why personal? Allows access to private repos if needed; shared tokens can hit rate limits quickly.
- Free; GitHub provides 5,000 requests/hour per token.
Screen.Recording.2025-12-02.at.20.08.01.mov
- Go to Google AI Studio.
- Sign in with a Google account (recommend your personal account since your organizational accounts might be blocked to use Google AI Studio), create a new project, and generate an API key.
- Note: Check pricing for heavier loads.
- Start with the free tier; upgrade to paid for more quota.
git clone https://github.com/cxy2696/GitHub-Discord-Bot.git
cd GitHub-Discord-Bot
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtCopy .env.example to .env and add your keys (Gemini, GitHub, Discord—generate personally for security).
In .env file in the root:
GEMINI_API_KEY='your_gemini_key_here'
GITHUB_TOKEN='your_github_token_here'
DISCORD_BOT_TOKEN='your_discord_token_here'
Ensure .env file get your APIs Store these APIs in a .env file (never commit it to GitHub—add to .gitignore) before run the python script in the terminal:
python bot.py
The bot is successfully running:
- Set repository:
!set_repoowner/repo - Link GitHub:
!link_githubusername - Personalized Challenge:
!my_challenge - Display Leaderboard:
!leaderboard - Sentiment Analysis:
!sentimentmessage_id - Manual Refresh if want:
!update_stats - Close the Client:
!shutdown
The testing example: