SOP 003 Discord Bot Setup
SOP-003: Discord AI Bot Setup
Ozzy (Claude) & Scout (Grok) — Atlantis ITS AI Squad
| Doc ID | SOP-003 | Version | 1.0 |
| Author | Shane Hardin / Ozzy | Date | 2026-03-25 |
| Category | Infrastructure / AI Squad | Status | Active |
1. Purpose
This SOP documents the end-to-end process for creating, configuring, and running a Discord bot for an Atlantis ITS AI squad member. It covers Discord Developer Portal setup, Python bot code structure, .env secret management, and keeping bots alive across reboots.
2. Prerequisites
-
Python 3.10+ installed
-
pip packages: discord.py, python-dotenv, anthropic (for Ozzy) or openai (for Scout)
-
Anthropic API key (console.anthropic.com) or xAI API key (for Scout)
-
Access to Discord Developer Portal (discord.com/developers/applications)
-
Golboni Discord server — #atlantis-ai-squad channel
-
Bot files folder — recommended: same folder as .env for easy key pickup
3. Discord Developer Portal Setup
3.1 Create the Application
-
Go to discord.com/developers/applications
-
Click + Create in the top right
-
Name the app (e.g. "Ozzy") → click Create
-
Under General Information, note the Application ID
3.2 Configure the Bot
-
In the left sidebar click Bot
-
Click Add Bot → Yes, do it!
-
Under Privileged Gateway Intents, enable Message Content Intent
-
Click Reset Token → copy the token immediately — you only see it once
NOTE: Paste the token into your .env file right away as OZZY_DISCORD_BOT_TOKEN=...
3.3 Invite the Bot to Your Server
-
Left sidebar → OAuth2 → URL Generator
-
Scopes: check bot
-
Bot Permissions: check Send Messages, Read Message History, View Channels
-
Copy the generated URL → paste in browser → select Golboni's server → Authorize
4. File & Environment Setup
4.1 Folder Structure
Place all bot files in the same folder so the .env is shared:
D:\Data\AtlantisITS\bots\
ozzy_bot.py
scout_bot.py
ozzy_memory.json (auto-created on first run)
discord_memory.json (Scout's memory, auto-created)
.env
4.2 .env File
The .env file holds all secrets. Never commit this to GitHub.
XAI_API_KEY=your_xai_key_here
DISCORD_BOT_TOKEN=scout_discord_token_here
OZZY_DISCORD_BOT_TOKEN=ozzy_discord_token_here
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
NOTE: Add .env to your .gitignore if this folder is tracked by Git.
4.3 Install Dependencies (one time)
Run from any PowerShell prompt:
pip install discord.py python-dotenv anthropic
5. Running the Bots
5.1 Manual Start
Open two separate PowerShell windows. Navigate to the bots folder in each:
cd D:\Data\AtlantisITS\bots
Then run one bot per window:
python ozzy_bot.py
python scout_bot.py
Confirm both bots are online — you should see:
Ozzy online as Ozzy#9512 🏛️
Scout online as Scout#XXXX 🚀
5.2 Testing in Discord
In #atlantis-ai-squad, trigger each bot with its command prefix:
!ozzy What's the status of the MkDocs pipeline?
!scout What tools should we evaluate for NTFY replacement?
5.3 Keeping Bots Alive (Auto-restart)
To survive reboots, use pm2 (Node.js process manager) or Windows Task Scheduler.
Option A — pm2 (recommended):
npm install -g pm2
pm2 start ozzy_bot.py --interpreter python
pm2 start scout_bot.py --interpreter python
pm2 save
pm2 startup
Option B — Windows Task Scheduler: create a task that runs python ozzy_bot.py on system startup with the bots folder as the working directory.
6. Getting the Anthropic API Key
-
Go to console.anthropic.com and sign in
-
Left sidebar → API Keys
-
Click Create Key → name it (e.g. Ozzy-Discord)
-
Copy the key immediately — it is only shown once
-
Paste into .env as ANTHROPIC_API_KEY=sk-ant-...
7. Security Notes
-
Never hardcode API keys in .py files — always use os.getenv() and .env
-
Never commit .env to any Git repo — add it to .gitignore
-
Bot tokens are single-server scoped — regenerate immediately if exposed
-
Ozzy's memory is stored in ozzy_memory.json locally — back up to E:\Backups\Projects\ periodically
8. Troubleshooting
| Issue | Fix |
| Bot goes silent after restart | Process stopped — re-run python ozzy_bot.py or set up pm2 auto-restart |
| API key not found error | Run bot from same folder as .env, confirm key name matches os.getenv() call |
| Bot not responding to !ozzy | Check Message Content Intent is enabled in Developer Portal → Bot tab |
| Bot not in server | Re-run the OAuth2 invite URL from Developer Portal → OAuth2 → URL Generator |
9. Related Documents
-
SOP-001 — PowerShell 7 Upgrade
-
SOP-002 — Epson ET4958 Printer Guide
-
KB: Atlantis AI Squad roles and responsibilities
-
ozzy_bot.py, scout_bot.py — bot source files
Atlantis ITS — Confidential Internal Document — SOP-003 v1.0