Discord webhooks

From Beasts of Bermuda
Revision as of 18:34, 13 July 2021 by Bermudabeast (talk | contribs) (Setting webhooks up)
Jump to: navigation, search

Using Discord webhooks

Beats of Bermuda, as of recently, supports Discord webhooks to better moderate your dedicated servers. For its setup, you will need
  • To implement Discord webhooks on your Discord Server.
  • To set up your Beasts of Bermuda Server server to communicate with your Discord server through a config setup.

With the Discord Webhooks, you can track your server(s) activity live and monitor chat, combat, group activity, logins/logouts, and admin command usage. These feeds can be put in separate private moderation channels, or all in the same spot and/or using the same Discord Webhook (not recommended).

Setting webhooks up

First of all, you will need to Create discord webhooks on your Discord server. Once that is done, open the Game.ini file, located under your {installFolder}/BeastsOfBermuda/Saved/Config/WindowsServer. If it does not exist, create it under this location.

Set the config up
-Copy-Paste the following text if it is not already there

[GameReporter]
ChatReportDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
ChatReportIconURL=""
LoginDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
LoginDiscordIconURL=""
AdminCmdDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
AdminCmdDiscordIcon=""
GroupActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
GroupAtivityDiscordIconURL=""
CombatActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
CombatActivityDiscordIconURL=""
bUseChatWebhook=False
ChatWebhookFormatStyle="[:x01]<{PlayerInfo}>[:x01] <ChatMode={ChatMode}> **>** _{msg}_"

bUseLoginReportWebhook=False
LoginReportFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] joined server _{Server}_\n----"
LogoutReportFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] left server _{Server}_, played for {Hours} hours and {Minutes} minutes.\n----"

bUseAdminCommandUsageWebhook=False
AdminCommandUsageFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] used command [:x01]{Cmd}[:x01]\n----"

bUseGroupActivityWebhook=False
bUseCombatActivityWebhook=False


Now, do not run away so soon! We will go through the settings together. The first thing you need to know, is that the webhook link setting automatically parses the link to the discord API. This means you only want to use part of the link provided by discord webhooks. Example:

https://discordapp.com/api/webhooks/864574086981222411/E4W2PurzqHUS6OnLVNWjNQIdEcoia4Q6nMYL46d6g3FxYR6BvyLMt3sWP0WphoZpsuoa
Becomes
864574086981222411/E4W2PurzqHUS6OnLVNWjNQIdEcoia4Q6nMYL46d6g3FxYR6BvyLMt3sWP0WphoZpsuoa

In order to enable a webhook, you want to set the matching config setting to True according to the following example:
Note that we will be using the chat webhook as an example but the exact same logic applies to every other GameReporter setting.

Create the chat webhook on your discord server according to the discord documentation. Fill up the config setting named

ChatReportDiscordWebhook

with the link you have just copy-pasted. Then, remove everything before the first numbers so your setting looks like the following:

ChatReportDiscordWebhook="12345679101112/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"

and set the matching setting to True as follows:

bUseChatWebhook=True

With that set up, you will have an active Chat webhook. If you want, you can also have a custom "Profile Picture" URL for the webhook you have setup by using any URL to an image supported by Discord. You can do this by setting the Icon setting matching your webhook. For the chat example, this would do as follows:

ChatReportIconURL="https://j.gifs.com/vQ8EzL.gif"



Setting up a custom format for Webhooks

Most of the webhooks support a custom format that you can set up how you wish. The example provided here represents every parameter supported per custom formats. Every format supports Markdown according to discord's documentation, HOWEVER, for parsing purposes, the following are handled by special syntax:

  • [:x01] is a a Backtick ( ` ), these are used by discord for "code blocks".
  • \n is a Backspace.

The default formats are as follows per webhook:

ChatWebhookFormatStyle="[:x01]<{PlayerInfo}>[:x01] <ChatMode={ChatMode}> **>** _{msg}_"
LoginReportFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] joined server _{Server}_\n----"
LogoutReportFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] left server _{Server}_, played for {Hours} hours and {Minutes}
AdminCommandUsageFormatStyle="Player [:x01]<{PlayerInfo}>[:x01] used command [:x01]{Cmd}[:x01]\n----"

Again, note the provided {parameter} are only applicable on the format styles they are used on. This means that, for example, the {Server} parameter only works on the login/logout webhook, or that the {Cmd} parameter is only available on the admin command usage webhook.

  • {PlayerInfo} is the Player name and Steam ID of the player the webhook is reporting. The steam ID will be built using the game owner account and the alt account ID if the player is using alt accounts, otherwise it will only show the owning account if they are not using an alt in the following style: OwnerAccount : PlayingAccount (eg 7653888282822842 : 76538388282822810).
  • {ChatMode} is the chat mode being used. this will be either A for All, G for Group, L for Local or DM for private messages.
  • {msg} will be the message sent by the player.
  • {Server} is the server name the player has logged in or out of. This will be the server name you are using in your command line
  • {Hours} is how many hours the player has played before logging out
  • {Minutes} is how many minutes the player has played before logging out.
  • {Cmd} is the command the player has used.

the output for such setup, using the Chat webhook as example, will look like this on Discord:

Text parse wb.png