Not in active development
This project implements a custom Discord Bot with integrated AI Backend and optional tool calling via MCP Integration.
- Chat with AI over Discord
- Customizability via
.envfile - Modular design
- Tool calling via MCP
- Custom MCP integrations
- Vision support for images
-
📦 Clone Repository:
git clone https://github.com/mathisxy/discord-ai.git cd discord-ai -
🧰 Install Dependencies
Make sure that Python 3.12+ is installed.
Create and activate a Python Virtual Environment:sudo apt install python3.12-venv python3 -m venv venv source venv/bin/activateAfterwards install the requirements:
pip install -r requirements.txt
-
🔑 Setup Environment Variables
Option 1: Manual- Copy the example file:
cp .env.example .env
- Open the
.envfile in your preferred editor and fill in the values:nano .env
Option 2: Interactive
-
Make sure
setup_env.pyis in your project directory. -
Run the setup script:
python setup_env.py
-
Follow the prompts.
-
For direct use via commandline rename the generated
.env.{botname}to.env:cp .env.{botname} .env
- Copy the example file:
-
▶️ Start BotOption 1: In the commandline
python main.py
Option 2: As a systemd service
python setup_service.py- ✅ Create and activate:
sudo cp {botname}.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start {botname} sudo systemctl enable {botname}- Check for errors:
journalctl -u {botname}.service- ❌ Stop and remove:
sudo systemctl stop {botname} sudo systemctl disable {botname} sudo rm /etc/systemd/system/{botname}.service sudo systemctl daemon-reload sudo systemctl reset-failedTip: Creating a systemd service allows your bot to run in the background and start automatically on boot.
After starting the bot, you can add it to your Discord server and interact with it.
- Go to your bot’s installation page on the Discord Developer Portal:
Discord Bot Installation - Scroll down to the “OAuth2 URL Generator / Bot” section.
- Under Scopes, make sure
botis selected. - Under Bot Permissions, choose the permissions your bot needs (Im currently not sure which are required)
- Copy the generated Invite Link.
- Open the link in your browser and select the server where you want to add the bot.
Tip: You must have the Manage Server permission on the server to add the bot.
-
Mention the bot in any channel to chat with it:
@Botname Hello! -
Slash commands are also available, e.g.:
/botname ...
The bot automatically builds a combined list of user data from Discord and an optional CSV file.
-
The bot collects all members who are currently online or idle on Discord.
Each Discord user contributes at least these two fields:Discord→ their display nameDiscord ID→ their unique Discord user ID
-
If a CSV file path is defined in
.envunderUSERNAMES_PATH,
the bot also loads that file and merges the entries using theDiscord IDfield as the key. -
The CSV file must include a column named
Discord ID.
All other columns are optional and will be integrated automatically if present
(for example,Discord,Name,Minecraft, orEmail). -
The final member list will include all Discord users and all CSV entries, even if one source is missing data for some users.
Overlapping fields from Discord take priority over CSV data.
Discord ID,Name,Discord,Minecraft
1388538139261538364,Emanuel,emanuel,ManuCraft
1423487340843761777,Helper,help_woman,HelpMaster
1584829348201934847,Luna,luna,LunaMC