# Discord integration
CSMM has the ability to integrate itself with your Discord server, allowing you to send and receive chat messages to your servers, get statistical information (most kills, playtime, etc.), as well as generate admin-oriented messages that can be sent to a separate hidden room for details about when players connect, disconnect, warnings about players with Global Ban List entries, and more. To do this, you need to enable the Discord bot on your Discord server.
Already have the Discord Chat Bridge integrated and are looking for the next steps? Hop down to the Administrative Notifications section to get instructions for adding administrative-type alerts to Discord.
# Configuring the Integration Settings
You must have administrative rights or control over user permissions for your Discord Server in order to execute the installation steps. Be careful who you give permission to for your linked channels.
- Anyone who can type in the Chat Bridge channel can send messages in-game to your 7 Days To Die server. Consider restricting the ability to transmit to this text channel to higher-ranked Discord members, or Admins only. 7 Days has a very limited size chat window, and Discord users can quickly overwhelm it with no way for in-game players to stop it.
- Limit who can see Administrative Notifications from the bot. They sometimes contain privileged information about player's Steam accounts, their IP address, and other normally-hidden info.
- In CSMM, browse to your server, and into the Settings area.
- Inside Settings, expand the Discord panel.
- Click Add bot to your server to trigger the invitation to Discord for Takaro.
- In the window that pops up, select your Discord server.
- On your server, Takaro will appear.
- Once Takaro is present on the server, go back to CSMM and select your Discord server from the dropdown next to the Select Guild button. If you don't see your server listed here, refresh the page.
- You will need to create one or more text channels for Takaro to send messages to. Consult Creating A Channel (opens new window) over at Discord for more information. The linked tutorial includes explanations for public and private channels. In this example, a 'chat' channel and an 'admin' channel were created. Normal users can see the 'chat' channel but not transmit to it, and only users with the Discord Role 7 Days Admins and above can see the 'admin' channel.
- Once the channels exist, you will need to either create a Discord Role for Takaro, or grant the Bot itself permissions to read and write to the channel. Take a look at Discord Permissions (opens new window) for assistance on this step. Takaro needs these specific permissions Text Permissions:
- Read Messages
- Send Messages
- Embed Links
- In CSMM, set the command Prefix for your chat channel. This is the character you add before any instructions to the bot; any lines that begin with this character will not be relayed to the game.
For example: typing !serverinfo will tell the bot to output all of your basic 7 Days server settings into the Discord channel.
- Set the Chat Bridge Channel dropdown to the channel on your server that you wish the in-game chat to be copied to. In the example above, this was csmm-chat.
- Set the Rich Messages checkbox to the value that you want. If enabled, when players join or leave the server, it will show a preview window of their name, have a link to their Steam Profile, and a copy of their Steam ID. If disabled, it will simply show their name. This setting only affects the chat channel, not the admin-specific notices which appear because of a different setting.
- Specify the 'blocked prefixes' for the chat channel in the text field. Typically, these prefixes are related to CSMM chat commands; CPM/Coppi/Alloc/Botman mods use in-game chat commands to trigger macros and features, and this feature prevents this commands from being relayed to the chat bridge. Typically these would be values such as / or ! or $.
If you have multiple prefixes (for example, if you have Botman and CPM at the same time), you can enter multiple prefixes to block here, each separated by a comma. In the example below, the / and ! and $ symbols are all blocked prefixes.
- Click Set Chat Channel to save the Chat Bridge settings.
At this point, your Chat Bridge should be functional.
# Chat Bridge Examples
As you can see, the message typed in Discord directly was relayed by Takaro, the CSMM Discord bot, over to the in-game chat. Regular chat is relayed back to Discord in the form of standard chat events by Takaro, while specific events (kill stream messages, server announcements, etc.) are relayed back in Markup format, shown below in the darker-backgrounded text. The three examples in the below screenshot are all server announcements.
# Administrative Discord Notifications
Beyond the basic two-way Chat Bridge, CSMM can also be configured to send administrative notifications to a channel as well. These notices are oriented around CSMM status updates, help ticket requests, automated task alerts, ban list updates, etc., and are recommended to not be visible to regular Discord users.
To configure the Administrative Notifications, follow the steps below:
- In CSMM, browse to your server, and into the Settings area.
- Inside Settings, expand the Discord panel.
- At the bottom of the window, click the 'Notifications' button.
- The Admin Notifications window will pop up. In the window, set as many of the notification types to a chat channel as you would like. Below are the types and explanations for each type of notification.
- CSMM Reboots - Alert when the CSMM platform goes down for maintenance or due to connection problems.
- Player Connect - Alert when players connect. These will always be the Rich Text alerts, including the Steam ID, Steam Profile, and name.
- Player Disconnect - Alert when players disconnect. Same notifications as the Connect alerts.
- Connection Lost - Alert when CSMM loses connection to the 7 Days Server.
- Reconnected - Alert when CSMM regains a connection to the 7 Days Server.
- Country Ban - Alert when players are blocked by the Country Ban kick system, if enabled.
- Tickets - Alert when players use the Call Admin feature to create a help ticket in-game.
- Automation Jobs - Alert when scheduled automated commands trigger.
- Global Ban List - Alert when a user on the Global Ban List joins, or is prevented from joining.
# Notification Examples
Below are some example outputs from the Discord integration functionality.
CSMM Restart Notfiication
An alert when the CSMM platform goes down for maintenance or due to connection problems.
Chat Bridge Status Notification
A notification that updates you on the status of the chat bridge. This appears after the chat bridge is reconfigured.
Lost and Connected Notification
Alert when CSMM loses connection to the 7 Days Server.
Ticket Notifications
Notifications for $calladmin tickets. You will receive a notification when a new ticket or comment is made.
Country Ban Notification
A notification that shows when a player gets kicked or banned by the country ban module.
Cron Job / Server Automation Notification
A notification that shows when an automated job has been run. This could also be used to keep a periodic log of some command output, such as world saves or player announcements.
GBL Notification
A notification that shows when a player joins that is on CSMM GBL list.
# Discord Bot Commands
Takaro does more than just relay chat back and forth and provide notifications: you can give Takaro instructions for to execute on the server, and also send commands to have the bot bring back data for you to use. These commands have the same privilege level as if they were run via RCON, so care must be taken granting people access to this ability. Use of these two commands requires the below role permissions in your Roles setup, and also requires you to link your Discord ID to your CSMM profile in the CSMM web interface.
# Working With Multiple 7 Days Servers
If you have more than one server configured to your Discord server (either for Chat Bridge or Admin functionality), you will need to specify which server the commands are sent to when executing, unless you want the command to go to the first server in the list. To determine the order of the servers in your link, type the command 'listservers', with the Discord Command Prefix set up above in front of it. By default, this prefix is $.
As shown in the screenshot, the PvP server is the first server, and Homicidal PVP is the second, so all commands will go to the PvP server unless otherwise specified.
To gather information on the second server, you would add the '2' to the end of the command.
# Common Commands
There are several commands you can use to quickly gather data from your 7 Days environment.
- Status - Gathers the current player list, FPS, Gametime and next horde night, zombie count, and more.
- Serverinfo - Creates an embedded post with the server's name, description, IP and port, map info, and general game settings.
- Top - Pull stats for various things ('playtime', 'zombies', 'players', 'deaths', 'currency', 'level' or 'score') for comparisons or leader boards.
- Lookup - Pull a full CSMM and 7 Days character profile for the specified player. This includes Steam data, IP, player inventory, and more. This command contains very sensitive information about the player, and should not typically be done in public.