~ping, reply to messages in your designated chat channel, and run on your own infrastructure with your own AI provider key. The bot keeps its conversation state, user memory, character memory, persona knowledge, and retrieval context in separate systems so the runtime stays modular and provider-agnostic.
1
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)
2
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 are adding it to an existing virtual environment manually, run:3
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
4
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:If the bot fails to start or you encounter errors in the console, see the Troubleshooting guide.
Option B — Use the local setup scripts (recommended for first-time setup):On Linux or macOS:
- Copy
.env.sampleto.envif.envdoes not 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 does not exist. - Install dependencies from
requirements.txt. - Run
scripts/check_project.pyto catch any project-level issues. - Launch
main.py.
CHANNEL_ID:5
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 do not 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.