This bot synchronizes Space Engineers player factions with a Discord server.
It creates:
- Discord roles per player faction
- Private text channels per faction
- Keeps a local SQLite database to safely track what the bot created
NPC / mod factions are ignored.
-
Only player factions are synced
-
A player faction is defined as:
Tag length === 3
-
-
NPC / default / mod factions (e.g.
NOMAD,IMBER,REAVER, etc.) are ignored -
Discord roles are created using the faction name
-
Discord channels are created using the faction name
-
If a channel name already exists, a numeric suffix is added:
apollo apollo-2 apollo-3 -
All created Discord objects are stored in a database for safe reuse & deletion
discord-SE-bot/
│
├── discord-se-bot.py # Main bot script
├── requirements.txt # Python dependencies
├── README.md
├── .gitignore
│
├── .env # NOT committed (Discord token)
├── .env.sample # Example environment file
│
├── config/
│ └── config.ini # Bot configuration
│
└── data/
└── se.db # SQLite database (auto-created)
- Python 3.10+ recommended
- Discord Bot Token
- Access to
Sandbox.sbcfrom a Space Engineers server
All dependencies are installed via requirements.txt:
discord.py>=2.3.2
python-dotenv>=1.0.0git clone git@github.com:mamba73/discord-se-bot.git
cd discord-se-botpython -m venv venvActivate it:
Windows
venv\Scripts\activateLinux / macOS
source venv/bin/activateIf you have only one Python version:
pip install -r requirements.txtIf you have multiple Python versions installed (recommended):
python -m pip install -r requirements.txtCreate .env in the project root:
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN.env to GitHub
Edit:
config/config.ini
Example:
[DISCORD]
GUILD_ID = 123456789012345678
CATEGORY_ID = 123456789012345678
[SPACE_ENGINEERS]
SANDBOX_SBC = D:\torch-server\Instance\Saves\world\Sandbox.sbc
[database]
DB_FILE = data/se.db
[GENERAL]
SYNC_INTERVAL = 60
DEBUG = true
DELETE_ALL = false
DISCORD_DELETE_UNUSED = falseDEBUG = true
- Enables verbose logging
- Recommended during development
DELETE_ALL = false
DANGEROUS – USE WITH CARE
- When true:
- Deletes ONLY Discord roles and channels created by this bot
- Uses database records for safety
- Bot exits immediately after cleanup
- Managed roles (bot roles) are never deleted
Use only for full reset scenarios.
DISCORD_DELETE_UNUSED = false
- When false:
- No automatic deletion of Discord objects
- When true:
- Allows cleanup of unused Discord roles/channels
- Currently conservative by design
python discord-se-bot.pyor (safe for multi-version setups):
python -m discord-se-bot.pyThe database is created automatically.
factionsplayersfaction_playerdiscord_rolesdiscord_channels
The database guarantees:
- No duplicate Discord objects
- Safe restarts
- Safe cleanup
To delete only objects created by the bot:
DELETE_ALL = trueWhat happens:
- Deletes only roles & channels recorded in the database
- Never touches manual Discord objects
- Bot exits automatically
You may see:
Privileged message content intent is missing
This is not an error.
The bot:
- Does NOT read messages
- Does NOT use commands
You can safely ignore this warning.
- ✔ Tag-based player faction detection
- ✔ NPC faction exclusion
- ✔ Duplicate-safe Discord channels
- ✔ Persistent database mapping
- ✔ Safe delete mode
- SteamID → Discord member role assignment
- Auto-cleanup of unused roles
- Torch / SE API integration
- Multi-server support
MIT / Private use — adapt as needed.
Developed by mamba73. Feel free to submit issues or pull requests!