Skip to content

Comdriver/7days-discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧟‍♂️ Zombie Alert - 7 Days to Die Discord Bot

WORK IN PROGRESS

Zombie Alert is a Discord bot for the game 7 Days to Die that helps monitor and manage your dedicated game server.
It can read server logs, announce in-game events to Discord, and provide admin commands through chat.

If SERVERTOOLS are installed on the server, bot can utilize some of the SERVERTOOLS commands.

This bot currently is only tested on game server version A21, but in theory should work on latest game versions. When I can, I will to tests with the latest game version and make a note here.


📜 Features

  • Reads server logs and posts updates to Discord
  • Sends alerts about hordes, player deaths, logins, and more
  • Custom commands for querying server status
  • Lightweight and configurable

🛠️ Commands

Command Description Admin Only
!backup Creates a backup of the current world (WORK IN PROGRESS)
!banlist Displays the list of banned players
!bloodmoon Shows when the next blood moon will occur and how much time is left
!playerban Bans a specified player from the server
!playerkick Kicks a player from the server
!players Lists players currently online
!players all Shows all registered players (online and offline) with extra details
!playerunban Removes a player from the ban list
!playerwhois Displays detailed info about a specific player (WORK IN PROGRESS)
!reboot Restarts the game server (WORK IN PROGRESS)
!saveworld Saves the current state of the world
!say Sends a message to the in-game chat
!serverstart Starts the server if it is offline (WORK IN PROGRESS)
!setchannel Sets the current Discord channel as the bot's output channel
!shutdown Shuts down the game server (WORK IN PROGRESS)
!status Displays the server's current status and autoshutdown info (if servertools mod installed and configured for autoshutdown)
!time Shows the current in-game time and date

🧪 Installation Instructions (Windows)

  1. Create a Discord bot in Discrod

    1. Go to the Developer Portal
    2. Create a New Application
      • Click the "New Application" button (top right).
      • Give your bot a name (this will be its display name).
      • Click "Create".
    3. Create the Bot
      • In the left sidebar, go to the “Bot” section.
      • Click “Add Bot”, then “Yes, do it!” to confirm.
      • (Optional) Set a profile picture or name for your bot.
    4. Get the Bot Token
      • Still in the “Bot” section, click “Reset Token” or “Copy” under Token.
      • Save the token somewhere safe – you’ll use it in your bot configuration.
      • ⚠️ Never share it! It gives full control of your bot.
  2. Install Python

    • Download the latest version of Python 3.13+ from python.org
    • Make sure to check ✅ "Add Python to PATH" during installation!
  3. Clone or download this repository

    git clone https://git.zodcode.tech/ZODCODE/7days-discord-bot.git
    cd your-bot-repo
  4. Install required packages

    WORK IN PROGRESS

  5. Configure the bot

    • Create bot.env file or copy sample.bot.env file to bot.env
    • Set your Discord bot token, log file path, and other settings
ENV Required Description Default value
GAME Game server executable file 7DaysToDieServer
GAME_PATH Location of your game installation
DATA_PATH Location, where your game data is stored, usually defined in serverconfig.xml as UserDataFolder and SaveGameFolder. 7DaysToDieServer
GAME_LOG Name for the game log files output_log
BOT_LOG Name for the bot log files zombie_alert
GAME_LOG_KEEP_COUNT How many game log files to keep 20
BOT_LOG_KEEP_COUNT How many bot log files to keep 20
GAME_MONITOR Defines if the bot should try to restart the sevrver if server is not running. 1 - run the server, 0 - just wait for the server to be started to other tools 0
SERVERTOOLS Defines if SERVERTOOLS mod is installed on the server. 1 - installed, 0 - no servertools 0
DISCORD_TOKEN Your discord bot token, you can generate one here
DISCORD_PREFIX Prefix for discord commands, like ! in !status !
DISCORD_CHANNEL Channel for the bot to output some server information, like server status or ingame chat. Can be set up after bot launch by using setchannel command
TELNET_HOST Address for your game server telnet 127.0.0.1
BM_START_TIME Time of the day, when Bloodmoon STARTS on your server 22:00
BM_END_TIME Time of the day, when Bloodmoon ENDS on your server 04:00
  1. Run the bot

    python 7daysbot.py
  2. Add the bot to your server

    1. Go to the Developer Portal again
    2. Go to the “OAuth2 > URL Generator”
      • In the left sidebar, go to “OAuth2” > “URL Generator”.
    3. Generate an Invite Link
      • Under Scopes, check: bot
      • Under Bot Permissions, check what your bot will need: Send Messages, Embed Links, Read Message History, Mention Everyone.
      • Copy the generated URL at the bottom.
    4. Invite the Bot to Your Server
      • Paste the URL into your browser and choose a server you manage.
      • Click “Authorize” and complete the CAPTCHA.
  3. Select channel for the bot notifications and ingame chat

    When in the channel you want to have all the bot notifications and ingame chat, just use this command:

    !setchannel

    Or enter your channel ID manually in the bot.env file as

    DISCORD_CHANNEL = YOUR_DISCORD_CHANNEL_ID

📦 Required Packages

WORK IN PROGRESS


LICENSE

This product is licensed under the Apache License, Version 2.0.

ZOD Code Elecronics Copyright 2025, Val Comdriver

About

a discord bot for 7 days to die game

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published