A Discord bot for STFC (Star Trek: Fleet Command) player verification with alliance rank-based role assignment.
- Player Verification: Verify STFC players via stfc.pro or stfc.wtf
- Rank-Based Role Assignment:
- Base ranks (Agent/Operative/Premier) → Base member role (assigned immediately)
- Leadership ranks (Commodore/Admiral) → Respective roles (after admin confirmation)
- Optional verification role (if configured)
- Periodic Updates: Automatically checks for rank changes every 24 hours
- Admin Confirmation: Leadership rank promotions require admin approval via buttons
- Screenshot Logging: Verification attempts are logged to Discord
pip install -r requirements.txtCopy .env.example to .env and fill in your values:
cp .env.example .envEdit .env with:
DISCORD_TOKEN: Your Discord bot tokenGUILD_ID: Your Discord server IDMEMBER_ROLE_ID: ID of the base member role (for Agent/Operative/Premier)COMMODORE_ROLE_ID: ID of the Commodore roleADMIRAL_ROLE_ID: ID of the Admiral roleADMIN_ROLE_ID: ID of admin role (for confirmations) - optionalVERIFY_ROLE_ID: ID of the verification role - optionalVERIFY_CHANNEL_ID: Channel where verification command can be usedLOG_CHANNEL_ID: Channel for logging verifications and confirmations
Create these roles in your Discord server:
- Member (or similar base role name)
- Commodore
- Admiral
- Verification (optional)
- Admin or similar (optional, for pinging admins)
python bot.pyVerify a player's STFC account.
Arguments:
player_link: stfc.pro/stfc.wtf URL or player ID (e.g.,https://stfc.pro/players/2659122580)screenshot: Screenshot of the player's STFC profile
Results:
- Sets Discord nickname:
[SERVER] ALLIANCE - USERNAME - Assigns member role (for base ranks) immediately
- For leadership ranks: posts confirmation request to admin
- Logs verification to LOG_CHANNEL with screenshot
| Rank | Tier | Role Assignment | Confirmation Needed |
|---|---|---|---|
| Agent | Base | Immediate ✓ | ❌ No |
| Operative | Base | Immediate ✓ | ❌ No |
| Premier | Base | Immediate ✓ | ❌ No |
| Commodore | Leadership | After Admin Approval | ✅ Yes |
| Admiral | Leadership | After Admin Approval | ✅ Yes |
- User runs
/verify_stfcwith player link and screenshot - Bot fetches player data from stfc.pro (including rank)
- Bot verifies player and sets nickname to
[SERVER] ALLIANCE - USERNAME - For base ranks (Agent/Operative/Premier): Member role assigned immediately ✓
- For leadership ranks (Commodore/Admiral): Admin gets confirmation message in LOG_CHANNEL with Accept/Reject buttons
- Admin clicks button to approve or deny the rank
- Verification logged to LOG_CHANNEL with player info
- Bot fetches all stored player links
- For each player:
- Updates player data from stfc.pro
- Detects any rank changes
- If rank changed: Posts confirmation request to LOG_CHANNEL
- Admin can accept/reject the rank change
| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN |
Yes | Discord bot token |
GUILD_ID |
Yes | Discord server ID |
MEMBER_ROLE_ID |
Yes | ID of base member role |
COMMODORE_ROLE_ID |
Yes | ID of Commodore role |
ADMIRAL_ROLE_ID |
Yes | ID of Admiral role |
VERIFY_ROLE_ID |
No | ID of verification role |
ADMIN_ROLE_ID |
No | ID of admin role (for pinging) |
VERIFY_CHANNEL_ID |
Yes | Channel where verification command works |
LOG_CHANNEL_ID |
Yes | Channel for logging and confirmations |
UPDATE_CHECK_HOURS |
No | Hours between periodic updates (default: 24) |
DB_PATH |
No | Path to SQLite database (default: stfc_players.db) |
DEBUG |
No | Enable debug logging (0 or 1, default: 0) |
The bot stores player data in SQLite (stfc_players.db). Stored information includes:
- Discord user ID
- STFC player ID and link
- Username, level, server
- Alliance tag
- Alliance rank (Agent, Operative, Premier, Commodore, Admiral)
- Verification status and timestamp
Database is automatically created on first run.
Logs are output to stdout. Enable debug logging by setting DEBUG=1 in .env.
Verification events are logged to LOG_CHANNEL with:
- Player name and rank
- Server and alliance information
- Verification screenshot
- Admin confirmation buttons (for leadership ranks)
v3.0 (Current):
- ✅ Switched to rank-based role assignment (Agent/Operative/Premier → Commodore/Admiral)
- ✅ Added admin confirmation flow for leadership ranks
- ✅ Detects rank changes during periodic updates
- ✅ Ranks extracted from stfc.pro player profiles