~ping, replying to messages in your designated chat channel, and running on your own infrastructure with your own AI provider key.
Create a Discord Application and Bot
Go to the Discord Developer Portal and create a new application.
- Click New Application, give it a name (this becomes your bot’s display name), and save.
- In the left sidebar, select Bot.
- Under Privileged Gateway Intents, enable all three required intents:
- MESSAGE CONTENT INTENT — required for prefix commands and reading message text
- GUILDS INTENT — required for server awareness
- GUILD MEMBERS INTENT — required for member-related features and moderation
- Click Reset Token, confirm, and copy the token somewhere safe. This is your
BOT_TOKEN.
bot and applications.commands. Under Bot Permissions, enable:- Send Messages
- Embed Links
- Attach Files
- Read Message History
- Manage Messages (required for the moderation module)
Clone the Repo and Install Dependencies
Clone Freesona and install its Python dependencies:
Windows users: Python’s
zoneinfo module may lack IANA time zone data on some Windows installs, which breaks /settimezone and other ZoneInfo lookups. The tzdata package is included in requirements.txt and installs automatically. If you’re adding it to an existing virtual environment manually, run:Configure Your .env File
Copy the sample environment file and fill in your values:Open
.env in a text editor. At minimum, set these values before launching:.env
| Variable | What to put here |
|---|---|
BOT_TOKEN | The bot token you copied from the Developer Portal |
CHANNEL_ID | The numeric ID of your #bot-log channel |
AI_PROVIDER | The provider you want to use (gemini is the default) |
GOOGLE_API_KEY | Your Gemini API key (or swap for another provider’s key — see AI Providers) |
MODEL_NAME | The model to use; gemini-flash-lite-latest is the default |
BOT_NAME | Display name used in startup messages |
HTTP_PORT | Port for the built-in health check and webhook server |
Launch the Bot
Option A — Direct launch:This starts the Discord bot and the built-in HTTP server (used for webhooks and health checks) as concurrent async tasks.
Option B — Use the local setup scripts (recommended for first-time setup):On Linux or macOS:On Windows:The setup scripts automate the full local bootstrap process:
Option B — Use the local setup scripts (recommended for first-time setup):On Linux or macOS:
- Copy
.env.sampleto.envif.envdoesn’t exist yet, then prompt you to fill it in. - Validate that
BOT_TOKEN,CHANNEL_ID, andAI_PROVIDERare set and not placeholder values. - Verify that the correct API key is present for your chosen
AI_PROVIDER. - Check that
CHANNEL_IDis a numeric Discord snowflake. - Create a
.venvvirtual environment if one doesn’t exist. - Install dependencies from
requirements.txt. - Run
scripts/check_project.pyto catch any project-level issues. - Launch
main.py.
CHANNEL_ID:Confirm the Bot Is Responding
In any channel your bot has access to, run:orThe bot should respond with a latency message. If it does, your bot is up and connected.From here you can:
- Set the AI chat channel with
/setchannelso the bot knows where to respond to general messages. - Check loaded modules with
/module list. - Set a persona with
/setpersona.
For cloud hosting on Railway or Render, the local setup scripts don’t apply — those platforms manage environment injection and process launch directly. See the Hosting guide for platform-specific setup steps, persistent volume configuration, and the
/data/ file paths required to survive redeployments.What’s Next
Configuration
Explore every
.env variable and live /config setting.Persona System
Give your bot a persona using structured fields.
AI Providers
Switch to Ollama, Groq, OpenRouter, or any other supported provider.