Getting Started
This guide will walk you through setting up Daia from scratch.
Table of Contents
- Prerequisites
- Installation
- Configuration
- Discord Bot Setup
- Running the Bot
- Verification
- Troubleshooting
- Next Steps
- Getting Help
Prerequisites
Before you begin, make sure you have:
1. Discord Bot Token
You’ll need to create a Discord application and bot:
- Go to the Discord Developer Portal
- Click “New Application” and give it a name
- Navigate to the “Bot” section in the left sidebar
- Click “Add Bot”
- Under the “Token” section, click “Reset Token” and copy it (you’ll need this later)
For detailed instructions, see the Discord Developer Documentation.
2. Google Gemini API Key
Get your API key from Google AI Studio:
- Sign in with your Google account
- Click “Get API Key”
- Create a new API key or use an existing one
- Copy the key (you’ll need this later)
3. Python Environment
This project requires Python 3.12 or higher. We use uv for dependency management, which will automatically handle the Python version requirement and create a virtual environment for you.
Installation
Step 1: Clone the Repository
git clone https://github.com/zhiro-labs/daia.git
cd daia
Step 2: Install uv (if needed)
If you don’t have uv installed, follow the official installation guide.
Quick install options:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# With pip
pip install uv
Step 3: Install Dependencies
uv sync
This command will:
- Create a virtual environment
- Install all required dependencies
- Set up the project for development
Configuration
Step 1: Create Configuration Files
Copy the example files to create your own configuration:
cp .env.example .env
cp config/chat_sys_prompt.txt.example config/chat_sys_prompt.txt
Step 2: Edit Environment Variables
Open the .env file in your favorite text editor and fill in the required values:
# Required
DISCORD_BOT_TOKEN=your_discord_bot_token_here
CHAT_MODEL_API_KEY=your_gemini_api_key_here
CHAT_MODEL=gemini-1.5-flash
CHAT_TEMPERATURE=1.0
HISTORY_LIMIT=50
CHAT_SYS_PROMPT_PATH=config/chat_sys_prompt.txt
# Optional
DISCORD_BOT_ACTIVITY=Chatting with friends
ALLOWED_CHANNELS=123456789,987654321
ENABLE_CONTEXTUAL_SYSTEM_PROMPT=on
CHAT_MODEL_PROVIDER=gemini
See the Configuration Reference for detailed explanations of each variable.
Step 3: Customize System Prompt
Edit config/chat_sys_prompt.txt to customize your bot’s personality and behavior. This file contains the instructions that guide how Daia responds to users.
Example:
You are Daia, a helpful and friendly AI assistant in a Discord server.
You provide clear, concise answers and maintain a casual, approachable tone.
When users ask questions, you provide accurate information and cite sources when possible.
Discord Bot Setup
Step 1: Enable Privileged Gateway Intents
In the Discord Developer Portal:
- Select your application
- Go to the “Bot” section
- Scroll down to “Privileged Gateway Intents”
- Enable the following:
- Server Members Intent (required for user recognition)
- Message Content Intent (required to read messages)
- Click “Save Changes”
Step 2: Configure Bot Permissions
When inviting the bot to your server, ensure it has these permissions:
General Permissions:
- View Channels
Text Permissions:
- Send Messages
- Attach Files
- Read Message History
Step 3: Generate Invite Link
- In the Developer Portal, go to “OAuth2” → “URL Generator”
- Select scopes:
botapplications.commands
- Select the permissions listed above
- Copy the generated URL and open it in your browser
- Select your server and authorize the bot
Running the Bot
Start Daia with:
uv run main.py
On first run, the bot will automatically download Noto CJK fonts (~100MB) for table rendering. This may take a few minutes depending on your internet connection.
You should see output similar to:
Logged in as Daia#1234
Ready to chat!
Verification
To verify everything is working:
- Go to your Discord server
- Send a message mentioning the bot:
@Daia hello! - The bot should respond with a greeting
If the bot doesn’t respond, check the Troubleshooting section below.
Troubleshooting
Bot doesn’t respond
Check intents:
- Ensure “Message Content Intent” is enabled in the Developer Portal
- Restart the bot after enabling intents
Check permissions:
- Verify the bot has “View Channels” and “Send Messages” permissions in the channel
- Check the channel’s permission overrides
Check configuration:
- Verify your
DISCORD_BOT_TOKENis correct - Check that the bot is online in your server’s member list
API Key errors
Invalid Gemini API key:
- Verify your
CHAT_MODEL_API_KEYis correct - Check that the API key is active in Google AI Studio
- Ensure you haven’t exceeded your API quota
Font download issues
Slow or failed font download:
- Check your internet connection
- The fonts are downloaded from GitHub releases
- If download fails, the bot will retry on next startup
Import or dependency errors
Module not found:
# Reinstall dependencies
uv sync --reinstall
Python version issues:
- Ensure you have Python 3.12 or higher
uvshould handle this automatically, but you can check withpython --version
Next Steps
Now that Daia is running, you can:
- Learn about Configuration & Usage
- Explore Development if you want to contribute
- Check out the Project Structure to understand the codebase
Getting Help
If you encounter issues not covered here:
- Check the GitHub Issues
- Start a Discussion
- Review the Discord Developer Documentation