{"id":26906757,"url":"https://github.com/1solon/shadow-empire-pbem-bot","last_synced_at":"2025-09-07T10:31:24.915Z","repository":{"id":282977258,"uuid":"950285968","full_name":"1Solon/Shadow-Empire-PBEM-Bot","owner":"1Solon","description":"A Discord bot for Shadow Empire turn notifications","archived":false,"fork":false,"pushed_at":"2025-08-25T16:22:55.000Z","size":95,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-30T20:44:48.172Z","etag":null,"topics":["bot","docker","docker-compose","golang","shadow-empire"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1Solon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-17T23:31:44.000Z","updated_at":"2025-08-25T16:21:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b2f32a0-3e96-444f-a7f9-2ad3d99e61f7","html_url":"https://github.com/1Solon/Shadow-Empire-PBEM-Bot","commit_stats":null,"previous_names":["1solon/shadow-empire-pbem-bot"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/1Solon/Shadow-Empire-PBEM-Bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Solon%2FShadow-Empire-PBEM-Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Solon%2FShadow-Empire-PBEM-Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Solon%2FShadow-Empire-PBEM-Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Solon%2FShadow-Empire-PBEM-Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1Solon","download_url":"https://codeload.github.com/1Solon/Shadow-Empire-PBEM-Bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Solon%2FShadow-Empire-PBEM-Bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026689,"owners_count":25209739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","docker","docker-compose","golang","shadow-empire"],"created_at":"2025-04-01T11:18:44.144Z","updated_at":"2025-09-07T10:31:24.877Z","avatar_url":"https://github.com/1Solon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Shadow Empire PBEM Bot\n\n_A Discord bot for automating player turns in Shadow Empire Play-By-Email (PBEM) games. Works in conjunction with file synchronization tools like Dropbox, Google Drive, or SyncThing._\n\n![GitHub Repo stars](https://img.shields.io/github/stars/1Solon/shadow-empire-pbem-bot?style=for-the-badge)\n![GitHub forks](https://img.shields.io/github/forks/1Solon/shadow-empire-pbem-bot?style=for-the-badge)\n\n\u003c/div\u003e\n\n---\n\n## ✨ Features\n\n- Monitors a directory for new Shadow Empire save files\n- Automatically detects which player just completed their turn\n- Determines the current turn number\n- Notifies the next player via Discord webhook when it's their turn\n- Sends configurable reminders to players who haven't taken their turn\n- Automatically detects if a save file is misnamed and informs the player\n- Configurable file name pattern matching and debouncing\n- Filters to only process expected file extensions (default: .se1)\n- Supports player resignations via simple files in the watch directory\n- Runs in Docker for easy deployment\n- Lightweight and efficient\n\n---\n\n## 🚀 Installation\n\n### Docker (Recommended)\n\nPull the latest image from GitHub Container Registry:\n\n```bash\ndocker pull ghcr.io/1solon/shadow-empire-pbem-bot:latest\n```\n\nOr use Docker Compose:\n\n```yaml\nversion: \"3\"\nservices:\n  shadow-empire-bot:\n    image: ghcr.io/1solon/shadow-empire-pbem-bot:latest\n    volumes:\n      # Map to Shadow Empire's default save location\n      - \"C:/Users/\u003cusername\u003e/Documents/My Games/Shadow Empire/\u003cgame name\u003e:/app/data\"\n    environment:\n      - USER_MAPPINGS=1 Player1 123456789012345678,2 Player2 234567890123456789\n      - GAME_NAME=PBEM1\n      - DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url\n      - WATCH_DIRECTORY=/app/data\n      - IGNORE_PATTERNS=backup,temp\n      - FILE_DEBOUNCE_MS=30000\n      - REMINDER_INTERVAL_MINUTES=720\n    restart: unless-stopped\n```\n\n### Go Installation\n\nTo build and run locally:\n\n```bash\ngit clone https://github.com/1Solon/shadow-empire-pbem-bot.git\ncd shadow-empire-pbem-bot\ngo build -o shadow-empire-bot .\n```\n\n---\n\n## 📚 Environment Variables\n\n| Variable                  | Description                                                                                 | Required | Default       |\n| :----------------------- | :------------------------------------------------------------------------------------------ | :------: | :------------ |\n| `USER_MAPPINGS`          | Comma-separated list of usernames and Discord IDs (format: `TurnNumber Username DiscordID`) |    ✅    | None          |\n| `GAME_NAME`              | Name prefix for save files                                                                  |    ❌    | \"pbem1\"       |\n| `DISCORD_WEBHOOK_URL`    | Discord webhook URL for notifications                                                       |    ✅    | None          |\n| `WATCH_DIRECTORY`        | Directory to monitor for save files                                                         |    ❌    | \"./data\"      |\n| `IGNORE_PATTERNS`        | Comma-separated patterns to ignore in filenames                                             |    ❌    | None          |\n| `FILE_DEBOUNCE_MS`       | Milliseconds to wait after file detection before processing                                 |    ❌    | 30000         |\n| `REMINDER_INTERVAL_MINUTES` | Minutes to wait before sending turn reminder notifications                               |    ❌    | 720 (12 hours) |\n| `POLL_INTERVAL_SEC`      | Seconds between directory scans                                                              |    ❌    | 5             |\n| `ALLOWED_EXTENSIONS`     | Comma-separated file extensions to process (no dots)                                         |    ❌    | se1           |\n\n### .env File Support\n\nThe bot also supports loading environment variables from a `.env` file. Create a file named `.env` in the same directory as the bot executable (or in your mounted `/app` directory when using Docker):\n\n```ini\nUSER_MAPPINGS=1 Player1 123456789012345678,2 Player2 234567890123456789\nGAME_NAME=PBEM1\nDISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url\nWATCH_DIRECTORY=./data\nIGNORE_PATTERNS=backup,temp\nFILE_DEBOUNCE_MS=30000\nREMINDER_INTERVAL_MINUTES=720\n```\n\n---\n\n## 📖 Usage\n\n### Setup\n\n1. Create a Discord webhook in your server\n2. Configure environment variables with player names and their Discord IDs\n3. Set up a shared folder for save files using a file synchronization tool\n4. Run the bot pointing to this shared folder\n\n\u003e **Recommendation:** Use Shadow Empire's default save location:  \n\u003e `C:\\Users\\\u003cusername\u003e\\Documents\\My Games\\Shadow Empire\\\u003cgame name\u003e`\n\n### Understanding USER_MAPPINGS\n\nThe `USER_MAPPINGS` environment variable connects in-game player names with Discord user IDs:\n\n```ini\nUSER_MAPPINGS=1 Player1 123456789012345678,2 Player2 234567890123456789\n```\n\nEach mapping follows the format `Order Username DiscordUserID` with multiple mappings separated by commas.\n\n#### How to Get Discord User IDs\n\nTo get a Discord user ID:\n\n1. Open Discord settings by clicking the gear icon near your username\n2. Go to \"Advanced\" and enable \"Developer Mode\"\n3. Right-click on the username of any user in your server\n4. Select \"Copy ID\" from the context menu\n\nThe copied ID is a long number (e.g., 123456789012345678) that uniquely identifies that Discord user.\n\n\u003e **Important:** Make sure the in-game player names exactly match the names of the players in your Shadow Empire game.\n\n### Running with Docker\n\n```bash\ndocker run -d \\\n  -e USER_MAPPINGS=\"1 Player1 123456789012345678,2 Player2 234567890123456789\" \\\n  -e GAME_NAME=\"PBEM1\" \\\n  -e DISCORD_WEBHOOK_URL=\"https://discord.com/api/webhooks/your-webhook-url\" \\\n  -e REMINDER_INTERVAL_MINUTES=\"720\" \\\n  -v \"C:/Users/\u003cusername\u003e/Documents/My Games/Shadow Empire/\u003cgame name\u003e:/app/data\" \\\n  ghcr.io/1solon/shadow-empire-pbem-bot:latest\n```\n\n### Running from Source\n\n```powershell\n$env:USER_MAPPINGS = \"1 Player1 123456789012345678,2 Player2 234567890123456789\"\n$env:GAME_NAME = \"PBEM1\"\n$env:DISCORD_WEBHOOK_URL = \"https://discord.com/api/webhooks/your-webhook-url\"\n$env:WATCH_DIRECTORY = \"C:/Users/\u003cusername\u003e/Documents/My Games/Shadow Empire/\u003cgame name\u003e\"\n$env:REMINDER_INTERVAL_MINUTES = \"720\"\n./shadow-empire-bot\n```\n\n---\n\n### Save File Naming Convention\n\nThe main Shadow Empire multiplayer community uses these naming formats:\n\n```text\nPBEM1_turn1_Player1\n```\n\nor\n\n```text\nPBEM1_Player1_turn1\n```\n\n\u003e **Note:** The number in PBEM1 can be incremented for different game instances (PBEM2, PBEM3, etc.)\n\nThis bot supports both styles and also tolerates missing trailing underscores.\n\n---\n\n## 🚪 Player Resignations\n\nYou can remove a player from the turn order by dropping a small \"resign\" file in the watch directory (same folder as your saves). The filename should contain the player's username and the word resign. Examples (case-insensitive):\n\n```text\nsolon_resign.se1\nresign_solon\nresign-solon\npbem1_resign_solon\nsolon-resign\nsolon.resign\n```\n\nNotes:\n\n- The username must match the one configured in `USER_MAPPINGS` (case-insensitive).\n- Resignations are detected at startup and during runtime.\n- Once a player resigns, they are removed from the active rotation and reminders for them are stopped.\n- If fewer than two players remain, the bot pauses turn processing until more players are active.\n- Startup behavior: existing resign files are honored but do not trigger a Discord ping. A ping is sent only when a new resign file appears while the bot is running.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1solon%2Fshadow-empire-pbem-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1solon%2Fshadow-empire-pbem-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1solon%2Fshadow-empire-pbem-bot/lists"}