Skip to content

sevenfifty777/DCS_Discord_Admin_Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ DCS Admin Bot

DCS Admin Bot Logo

A full-featured Discord-based administration bot and in-game command monitor for DCS World Dedicated Server. This system links your DCS server with Discord and in-game chat, allowing powerful remote control, player moderation, logging, and mission management. The Bot should be installed and configured on your DCS server


๐Ÿ”ง Requirements

โœ… System Requirements

  • Windows-based DCS Dedicated Server
  • Python 3.10+ (if using python version)
  • Discord account with server management rights
  • DCS SimpleRadio Standalone (SRS) (optional)

๐Ÿ“ฆ Python Dependencies (not need if using exe)

Install via:

pip install -r requirements.txt

๐Ÿค– Discord Bot Setup

  1. Visit the Discord Developer Portal
  2. Create a new application and add a bot
  3. Enable intents under the Bot tab:
    • Message Content Intent
    • Server Members Intent
  4. Under OAuth2 โ†’ URL Generator:
    • Scopes: bot, applications.commands
    • Bot Permissions: Send Messages, Embed Links, Attach Files, Manage Messages, Use Slash Commands
  5. Invite the bot to your server using the generated URL
  6. Copy the bot token and your server (guild) ID

โš™๏ธ Configuration

Files Installation

  1. Unzip the last released it should contain 2 folders
    • Hooks , ensure discord_admin_allinone_hook.lua is in Hooks folder
    • Discord_Admin_Bot folder , where you will found DCSAdminBot.exe and run_dcs_bot.ps1 (those script should work in any place on your server but recommended to keep everything inside this folder where all files and logs will be created/updated)
  2. copy all folder into your C:\Users<user>\Saved Games\DCS\Scripts
  3. set up all you env. variables

๐Ÿ” Environment Variables

Set the following (in the run_dcs_bot.ps1):

   Set Discord Server, Bot
$env:DISCORD_BOT_TOKEN = "your_token_here"
$env:DISCORD_GUILD_ID = "your_guild_id"

   Set Roles, Users
$env:DISCORD_ADMIN_USER_IDS = ""  # optional with Roles can be empty<-- Replace with your admin Discord user IDs (comma-separated)
$env:DISCORD_ADMIN_ROLE_NAMES = "Server Admins"  # <-- Replace with your admin role names (comma-separated)

   Set channel IDs
$env:DISCORD_UPLOAD_CHANNEL_ID = "123456789012345678"  # <-- Replace with your upload channel ID
$env:DISCORD_FFIRE_ALERT_CHANNEL_ID = "123456789012345678"  # <-- Replace with your Friendly Fire Alert channel ID
$env:DISCORD_STARTUP_GREETING_CHANNEL_ID = "123456789012345678"  # <-- Replace with your startup greeting channel ID
$env:DISCORD_STATUS_UPDATE_CHANNEL_ID = "123456789012345678"  # <-- Replace with your status update channel ID

   Set DCS, SRS path
$env:DCS_SERVER = "C:\Path\To\DCS-Server"
$env:DCS_SAVED_GAMES = "C:\Users\<user>\Saved Games\DCS"
$env:SRS_SERVER = "C:\Path\To\SR-Server.exe"
$env:SRS_SERVER_CFG = "C:\Path\To\server.cfg"

   set Path to exe
Start-Process -FilePath "C:\Users\<user>\Saved Games\DCS\Scripts\Discord_Admin_Bot\DCSAdminBot.exe" -NoNewWindow -Wait

๐Ÿ“ Folder Structure

  • Scripts\Discord_Admin_Bot\ โ€“ text command files, & Logs
  • Scripts\Hooks\ - Lua hook
  • Missions\ โ€“ Mission files and save folders (foothold)
  • Config\serverSettings.lua โ€“ Server config file

๐Ÿš€ Launching

PowerShell

You can use the template script:

.\run_dcs_bot.ps1

This script sets up environment variables and runs the bot in the background (no window pop-up if configured via Task Scheduler).


๐Ÿ—“๏ธ Run on Startup via Task Scheduler

To launch the bot automatically when the server starts:

๐Ÿงพ Steps

  1. Open Task Scheduler (taskschd.msc)

  2. Click Create Task

  3. Under General tab:

    • Name: DCS Admin Bot
    • Select Run whether user is logged on or not
    • Check Run with highest privileges
  4. Under Triggers tab:

    • Click New
    • Begin the task: At startup
    • Click OK
  5. Under Actions tab:

    • Click New

    • Action: Start a program

    • Program/script: powershell.exe

    • Add arguments (replace path as needed):

      -WindowStyle Hidden -ExecutionPolicy Bypass -File "C:\Users\USERNAME\Saved Games\DCS.dcs_serverrelease\run_dcs_bot.ps1"
      
  6. Click OK, enter Server Admin credentials when prompted.

โœ… Notes

  • Make sure run_dcs_bot.ps1 is present at the specified path.
  • The script will run silently without opening a PowerShell window.
  • You can confirm operation via dcs_admin_bot.log or the botโ€™s presence in Discord.

๐Ÿ’ฌ Available Commands

๐ŸŽฎ In-Game Chat Commands (for Admins)

Use in the in-game chat (coalition or global):

Command Description
!addadmin [PlayerName] Promote a connected player to admin
!removeadmin [PlayerName] Remove admin rights from a connected player
!ban [PlayerName] duration reason Ban player (duration in seconds, 0 = permanent)
!unban [PlayerName] Remove a player from banlist
!pause / !unpause Pause/unpause the mission

โœ… Notes

you can create this file in Discord_Admin_Bot folder manually and add UCID of player to give admin right and use in-game command or use !addadmin command: admin_ucids.txt

When player are banned or unbanned , it update the same list used by Discord bot, so all player are ban/uban both way


๐Ÿ›ฐ๏ธ Discord Slash Commands

Use Discord slash commands for bot control. Admin-only commands are restricted via role/user ID config. Discord Slash Commands

Mission Control

  • /uploadmission ๐Ÿ“ค Upload a .miz file to server (requires upload channel)
  • /listmissions ๐Ÿ“œ List missions on server
  • /loadmission number ๐Ÿ”„ Load mission by number
  • /missioninfo โ„น๏ธ Show current mission status

Server Control

  • /pause โธ๏ธ Pause mission
  • /unpause โ–ถ๏ธ Unpause mission
  • /restartmission ๐Ÿ” Restart current mission
  • /restart_dcs_server ๐Ÿ› ๏ธ Kill & restart DCS Server
  • /dcsupdate โฌ†๏ธ Update DCS via DCS_updater.exe (it should bypass UAC prompt and launch silent update, also MissionScripting.lua is updated before server restart) Not fully tested with real update , No DCS update form ED at the time The bot is released
  • /update_missionscripting ๐Ÿ“‚ Update MissionScripting.lua (it try to found MissionScripting.lua (must be desanitized) in Saved Game\Scripts and copy to Server installation Scripts folder)
  • /restart_srs ๐Ÿ”Š Restart SRS server (Bug note: after restart SRS is running as service but no SRS GUI shows up)

Players & Logs

  • /dcsplayers ๐Ÿง‘โ€โœˆ๏ธ Recent unique players
  • /dcsconnections ๐Ÿ”Œ Show recent player connections
  • /dcsban player duration reason ๐Ÿšซ Ban a player
  • /dcsunban player โœ… Unban a player
  • /dcsbanlist ๐Ÿ“‹ View active banlist
  • /playerstats ๐Ÿ“ˆ Detailed player session stats
  • /footholdstats ๐Ÿช– Extract killboard stats from Foothold save

Status & Help

  • /status ๐Ÿ“ก Live server & mission status
  • /help ๐Ÿ“˜ List all bot commands

๐Ÿ“ Files Generated

The bot uses and maintains the following files:

File Purpose
player_log.csv Logs player joins/leaves and events
banlist.txt Persistent bans
kickqueue.txt Temporary kicks (via Discord)
chatcmd.txt Queue for in-game bot chat messages
missioncmd.txt Discord โ†’ DCS command channel
missioninfo.txt, missionstatus.txt, missionlist.txt Status and mission details
friendlyfire.txt Friendly fire log
admin_ucids.txt Admin list for in-game chat command

๐Ÿ“Š Foothold Integration

If you use the Foothold Campaign, you can run /footholdstats to generate a leaderboard from any .lua save file in the Missions/Saves directory.


๐Ÿงช Advanced Features

  • Friendly fire watcher with Discord alerts (not tested)
  • Auto-update mission list (it does NOT update serverSettings so list is not persitente after restart of DCS)
  • UCID-based player management
  • Supports both role-based and user ID-based admin permission checks
  • DCS server auto-restart on update (possible bug)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors