Difference between revisions of "Discord webhooks"

From Beasts of Bermuda
Jump to: navigation, search
m (Using Discord webhooks)
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Using [https://discord.com Discord] webhooks=
+
= Using [https://discord.com Discord] webhooks =
;Beats of Bermuda, as of recently, supports Discord webhooks to better moderate your dedicated servers. For its setup, you will need:
+
;Beasts 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 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.
+
*To set up your Beasts of Bermuda 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'''.
 
With the Discord Webhooks, you can track your server(s) activity live and monitor '''chat, combat, group activity, logins/logouts, and admin command usage'''.
Line 8: Line 8:
 
<br>
 
<br>
 
<br>
 
<br>
=Setting webhooks up=
+
 
 +
= Setting webhooks up =
 
First of all, you will need to [https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks Create discord webhooks on your Discord server].
 
First of all, you will need to [https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks 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.
+
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:
 
;Set the config up:
;- First of all, Copy-Paste the following text if it is not already there: <br>
+
; -Copy-Paste the following text if it is not already there: <br>
 
<syntaxhighlight lang="ini">
 
<syntaxhighlight lang="ini">
 
[GameReporter]
 
[GameReporter]
Line 23: Line 24:
 
AdminCmdDiscordIcon=""
 
AdminCmdDiscordIcon=""
 
GroupActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
 
GroupActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
GroupAtivityDiscordIconURL=""
+
GroupActivityDiscordIconURL=""
 
CombatActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
 
CombatActivityDiscordWebhook="123456/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"
 
CombatActivityDiscordIconURL=""
 
CombatActivityDiscordIconURL=""
 +
 
bUseChatWebhook=False
 
bUseChatWebhook=False
 
ChatWebhookFormatStyle="[:x01]<{PlayerInfo}>[:x01] <ChatMode={ChatMode}> **>** _{msg}_"
 
ChatWebhookFormatStyle="[:x01]<{PlayerInfo}>[:x01] <ChatMode={ChatMode}> **>** _{msg}_"
Line 37: Line 39:
  
 
bUseGroupActivityWebhook=False
 
bUseGroupActivityWebhook=False
 +
bUseCombatActivityWebhook=False
 +
</syntaxhighlight>
  
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:'''<br>
 +
<syntaxhighlight lang="markdown">
 +
https://discordapp.com/api/webhooks/864574086981222411/E4W2PurzqHUS6OnLVNWjNQIdEcoia4Q6nMYL46d6g3FxYR6BvyLMt3sWP0WphoZpsuoa
 +
Becomes
 +
864574086981222411/E4W2PurzqHUS6OnLVNWjNQIdEcoia4Q6nMYL46d6g3FxYR6BvyLMt3sWP0WphoZpsuoa
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
In order to enable a webhook, you want to set the matching config setting to ''True'' according to the following example: <br>
 +
Note that we will be using the chat webhook as an example but the exact same logic applies to every other GameReporter setting.<br>
 +
Create the chat webhook on your discord server according to the [https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks discord documentation]. Fill up the config setting named <syntaxhighlight lang="ini">ChatReportDiscordWebhook</syntaxhighlight> with the link you have just copy-pasted. Then, remove everything before the first numbers so your setting looks like the following: <syntaxhighlight lang="ini">ChatReportDiscordWebhook="12345679101112/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"</syntaxhighlight>
 +
and set the matching setting to '''True''' as follows: <syntaxhighlight lang="ini">bUseChatWebhook=True</syntaxhighlight>
 +
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:
 +
<syntaxhighlight lang="ini">ChatReportIconURL="https://j.gifs.com/vQ8EzL.gif"</syntaxhighlight>
 +
<br><br>
 +
== 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 [[#Setting webhooks up|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:
 +
<syntaxhighlight lang="ini">
 +
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----"
 +
</syntaxhighlight>
 +
'''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 [[Dedicated Servers| 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:
 +
[[File:Text parse wb.png|left|thumb]]
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
 +
= Config settings details =
 +
*ChatReportDiscordWebhook is the webhook that will be used for chat activity.
 +
*ChatReportIconURL is the URL to an icon to use for the chat discord webhook (optional)
 +
*LoginDiscordWebhook is the webhook used to track login/logout activity on your server
 +
*LoginDiscordIconURL is the URL to an icon to use for the login discord webhook (optional)
 +
*AdminCmdDiscordWebhook is the webhook used to track command usage activity on your server
 +
*AdminCmdDiscordIcon is the URL to an icon to use for the command usage tracking webhook (optional)
 +
*GroupActivityDiscordWebhook is the webhook used to track group activity (group creation, adding, removing of players...)
 +
*GroupActivityDiscordIconURL is the URL to an icon to use for the group activity tracking on your server (optional)
 +
*CombatActivityDiscordWebhook is the webhook to use to report combat activity. This will output a full combat log leading to every player's death in blocks of text.
 +
*CombatActivityDiscordIconURL is the URL to an icon to use for the combat activity on your server (optional)
 +
*bUseChatWebhook True/False enables or disables the chat webhook. False by default.
 +
*bUseLoginReportWebhook True/False enables or disables the login webhook. False by default.
 +
*bUseAdminCommandUsageWebhook True/False enables or disables the command usage webhook. False by default.
 +
*bUseGroupActivityWebhook True/False enables or disables the group activity webhook. False by default.
 +
*bUseCombatActivityWebhook True/False enables or disables the combat activity webhook. False by default.
 +
*ChatWebhookFormatStyle is a text format to use for the chat webhook.
 +
*LoginReportFormatStyle is a text format to use for the login/logout webhook when logging in.
 +
*LogoutReportFormatStyle is a text format to use for the login/logout webhook when logging out.
 +
*AdminCommandUsageFormatStyle is a text format to use for the command usage webhook.
 +
<br><br>
  
Now, do not run away so soon! We will go through these settings together.
+
= Output examples =
The first thing you need to know, is that the webhook link automatically parses the link to the discord API. This means you only want to use part of the link provided by discord webhooks.<br>
+
== Combat webhook output example ==
We will use the chat webhook as an example. Create the chat webhook on your discord server according to the [https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks discord documentation]. Then, fill up the config setting named <syntaxhighlight lang="ini">ChatReportDiscordWebhook</syntaxhighlight> with the link you have just copy-pasted. Then, remove everything before the first numbers so your setting looks like the following: <syntaxhighlight lang="ini">ChatReportDiscordWebhook="12345679101112/examplekey_dwdhwaowdawbdwaowdcic11938374-ce"</syntaxhighlight>
+
[[File:Pt-combat.png|left|thumb|Combat output example for the Combat webhook.]]
 +
<br><br><br><br><br><br><br><br><br><br><br><br><br>
 +
== Group activity webhook output example ==
 +
[[File:Pt-groups.png|left|thumb|Group output example for the group webhook]]
 +
<br><br><br><br><br><br><br><br><br><br>
 +
== Command activity webhook output example ==
 +
[[File:Pt-cmd.png|left|thumb|Command activity output example for the command usage webhook]]
 +
<br><br><br><br><br><br>
 +
;There, now you know how to set up Discord webhooks for your Beasts Of Bermuda Server!

Latest revision as of 21:17, 20 September 2021

Using Discord webhooks

Beasts 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 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"
GroupActivityDiscordIconURL=""
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







Config settings details

  • ChatReportDiscordWebhook is the webhook that will be used for chat activity.
  • ChatReportIconURL is the URL to an icon to use for the chat discord webhook (optional)
  • LoginDiscordWebhook is the webhook used to track login/logout activity on your server
  • LoginDiscordIconURL is the URL to an icon to use for the login discord webhook (optional)
  • AdminCmdDiscordWebhook is the webhook used to track command usage activity on your server
  • AdminCmdDiscordIcon is the URL to an icon to use for the command usage tracking webhook (optional)
  • GroupActivityDiscordWebhook is the webhook used to track group activity (group creation, adding, removing of players...)
  • GroupActivityDiscordIconURL is the URL to an icon to use for the group activity tracking on your server (optional)
  • CombatActivityDiscordWebhook is the webhook to use to report combat activity. This will output a full combat log leading to every player's death in blocks of text.
  • CombatActivityDiscordIconURL is the URL to an icon to use for the combat activity on your server (optional)
  • bUseChatWebhook True/False enables or disables the chat webhook. False by default.
  • bUseLoginReportWebhook True/False enables or disables the login webhook. False by default.
  • bUseAdminCommandUsageWebhook True/False enables or disables the command usage webhook. False by default.
  • bUseGroupActivityWebhook True/False enables or disables the group activity webhook. False by default.
  • bUseCombatActivityWebhook True/False enables or disables the combat activity webhook. False by default.
  • ChatWebhookFormatStyle is a text format to use for the chat webhook.
  • LoginReportFormatStyle is a text format to use for the login/logout webhook when logging in.
  • LogoutReportFormatStyle is a text format to use for the login/logout webhook when logging out.
  • AdminCommandUsageFormatStyle is a text format to use for the command usage webhook.



Output examples

Combat webhook output example

Combat output example for the Combat webhook.














Group activity webhook output example

Group output example for the group webhook











Command activity webhook output example

Command activity output example for the command usage webhook







There, now you know how to set up Discord webhooks for your Beasts Of Bermuda Server!