Plugins/SEDiscordBridge

From Torch Wiki
Revision as of 14:20, 28 January 2020 by Omghixd (talk | contribs) (→‎Settings Explained)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A Torch plugin to connect your torch server to Discord

Discord Bot Creation

You need to create a discord BOT to your Discord channel. Follow these instructions: https://goo.gl/5Do8LJ

Then add the bot to your server by replacing CLIENTID with your bot's client ID (Found in the o2Auth tab) https://discordapp.com/oauth2/authorize?&client_id=CLIENTID&scope=bot&permissions=8

Example Configuration File

<?xml version="1.0" encoding="utf-8"?>
<SEDBConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <Enabled>true</Enabled>
 <PreLoad>true</PreLoad>
 <DataCollect>false</DataCollect>
 <BotToken>YOURTOKENHERE</BotToken>
 <ChatChannelId>ID NUMBER HERE</ChatChannelId>
 <Format>:rocket: **{p}**: {msg}</Format>
 <Format2>[Discord]{p}</Format2>
 <CommandChannelId>ID NUMBER 2 HERE</CommandChannelId>
 <CommandPrefix>!</CommandPrefix>
 <AsServer>false</AsServer>
 <UseNicks>false</UseNicks>
 <ServerToDiscord>false</ServerToDiscord>
 <ServerName>Discord</ServerName>
 <StatusChannelId>ID NUMBER 3 HERE</StatusChannelId>
 <Started>:white_check_mark: Server Started!</Started>
 <Stopped>:x: Server Stopped!</Stopped>
 <Connect>:key: The player {p} connected to server</Connect>
 <Join>:sunny: The player {p} joined the server</Join>
 <Leave>:new_moon: The player {p} left the server</Leave>
 <UseStatus>true</UseStatus>
 <StatusInterval>30000</StatusInterval>
 <StatusPre>Server Starting...</StatusPre>
 <Status>{uptime@hh:mm} | {p} players | SS {ss}</Status>
 <StatusPlayers>true</StatusPlayers>
 <StatusUrl>URL HERE</StatusUrl>
 <MentOthers>true</MentOthers>
 <MentEveryone>false</MentEveryone>
 <TokenVisibleState>Visible</TokenVisibleState>
 <RemoveResponse>2000</RemoveResponse>
 <FactionChannels />
 <GlobalColor>White</GlobalColor>
 <FacColor>Green</FacColor>
 <FacFormat>:ledger: **{p}**: {msg}</FacFormat>
 <FacFormat2>[D-Fac]{p}</FacFormat2>
</SEDBConfig>

The name of the config file is "SEDiscordBridge.cfg"


External Resource Information

SEDiscordBridge uses the library DSharpPlus. More info here: https://github.com/DSharpPlus/DSharpPlus

We use this library included in our release files following the MIT License from here: https://github.com/DSharpPlus/DSharpPlus/blob/master/LICENSE

All code required for the bot is handled by the plugin. You just need to enter the token and other fields.

To get channel IDs, go to the Appearance tab in your Discord user settings and switch on "Developer mode", then right click any channel and select "Copy ID"

Settings Explained

Under construction


    <Enable>

  • Description: Enable or Disable the plugin.
  • Values Accepted: False/True
  • <Preload>
  • Description: This will make the bot go online as soon as Torch.Server.exe is running
  • Values Accepted: False/True
  • <BotToken>
  • Description: Unique Token grabbed from https://discordapp.com/developers/applications which is the identity of your BOT
  • Values Accepted: 59 Characters combined with numbers and Special Characters
  • <ChatChannelId>
  • Description: Unique Channel ID for the In-Game Chat. In order to retrieve this Channel ID, simply right click the channel of choice and click "Copy ID"
  • Values Accepted: 18 Characters (Numbers)
  • <Format>
  • Description: User Defined Format correlating to how you want Messages to Display on the Channel of Choice.
  • "Example: :speech_left: **{p}**: {msg}"
  • :speech_left: - Discord Icon Code
  • **{p}** - Player-Name
  • (msg) - Message Written In-Game
  • Values Accepted: Anything of choice
  • <Format2>
  • Description: User Defined Format correlating to how you want Messages to Display In-Game
  • "Example: [Discord-MSG] {p}"
  • [DISCORD-MSG] - Prefix (Adds in-front of the Username / ServerName in In-Game Chat
  • {p} - Player-Name
  • Values Accepted: Anything of choice
  • <CommandChannelId>
  • Description: Unique Channel ID for the Command Channel. In order to retrieve this Channel ID, simply right click the channel of choice and click "Copy ID"
  • Values Accepted: 18 Characters (Numbers)
  • <AsServer>
  • Description: Allows the server to post messages in ChatChannel (discord) as <ServerName> instead of Player-Name
  • Values Accepted: False/True
  • <UseNicks>
  • Description: Use Discord Nicknames when posting message from Discord to In-Game Chat
  • Values Accepted: False/True
  • <BotToGame>
  • Description: Makes Bot Messages from Discord be sent to In-Game Chat.
  • Values Accepted: False/True
  • <ServerToDiscord>
  • Description: Makes Server Messages from In-Game be sent to Discord Chat Channel
  • Values Accepted: False/True
  • <ServerName>
  • Description: Custom Prefix for Servername if <AsServer> is Enabled
  • Values Accepted: Anything of choice
  • <StatusChannelId>
  • Description: Unique Channel ID for Server Activities (i.e Server Started/Stopped, Player Connected/Disconnected) In order to retrieve this Channel ID, simply right click the channel of choice and click "Copy ID"
  • Values Accepted: 18 Characters (Numbers)
  • <Started>
  • Description: Custom Message for when the server has Started
  • Values Accepted: Anything of choice
  • <Stopped>
  • Description: Custom Message for when the server has Stopped
  • Values Accepted: Anything of choice
  • <Connect>
  • Description: Custom Message for when a player Connects to the server
  • Values Accepted: Anything of choice
  • <Join>
  • Description: Custom Message for when a player Joins to the server for the first time
  • Values Accepted: Anything of choice
  • <Leave>
  • Description: Custom Message for when a player Leaves to the server
  • Values Accepted: Anything of choice
  • <SimPing>
  • Description: Setting for bot SimPing to either be on/off - This system will alert you if <SimTresh> Value is met
  • Values Accepted: False/True
  • <SimChannel>
  • Description: Unique Channel ID for SimPing Notifications (i.e If server hits 0.7SimSpeed then Notify in this channel) In order to retrieve this Channel ID, simply right click the channel of choice and click "Copy ID"
  • Values Accepted: 18 Characters (Numbers)
  • <SimTresh>
  • Description: Value set to Notify if set value of SimSpeed is met
  • Values accepted: Anything of Choice (recommendation: 0.75SimSpeed)
  • <SimMessage>
  • Description: Custom set message to post in <SimChannel> if <SimTresh> Value is met (i.e SimSpeed is now at an un-usual level. Please investigate)
  • Values Accepted: Anything of Choice
  • <SimCooldown>
  • Description: This determines how often a SimSpeed drop notification can be posted (default value: 60seconds)
  • Values Accepted: Anything of Choice (recommendation: 120 - 320)
  • <UseStatus>
  • Description: Setting for bot Status to either be on/off (i.e Bot Playing - <StatusPre>)
  • Values Accepted: False/True
  • <StatusInterval>
  • Description: Value which determines how often Bot Status should update in ?milliseconds?
  • Values Accepted: Anything of Choice (recommendation: 1000)
  • <StatusPre>
  • Description: Custom Bot Playing Message
  • "Example: {p} {ss} {uptime@HH:mm}"
  • {p} - Player-Amount
  • (SS) - SimSpeed
  • {uptime@HH:mm} - Uptime = How long it has been up Activator | HH = Hours | mm = Minutes
  • Values Accepted: Anything of choice
  • <MentOthers>
  • Description: Allows for users to mention other users from In-Game Chat within <ChatChannelId>
  • Values Accepted: False/true
  • <TokenVisibleState>
  • Description: Setting to show Token within GUI or to Hide
  • Values Accepted: Collapsed/Visible
  • <RemoveResponse>
  • Description: Removes bot/server response in <CommandChannelId> correlating to set value in seconds
  • Values Accepted: Anything of Choice (recommendation: 30)
  • <FactionChannels>
  • Description: TO BE CONTINUED
  • Values Accepted:
  • <GlobalColor>
  • Description: Determines what color messages from Discord to In-Game Chat should be set to
  • Values Accepted: Anything (default: Green)
  • <FacColor>
  • Description: Determines what color Faction Messages from Discord to In-Game Faction Chat should be set to
  • Values Accepted: Anything (default: Green)
  • <FacFormat>
  • Description: User Defined Format correlating to how you want Faction Messages to Display in <FactionChannels>
  • "Example: :ledger: **{p}**: {msg}"
  • :ledger: - Discord Icon Code
  • **{p}** - Player-Name
  • (msg) - Message Written In-Game
  • Values Accepted: Anything of choice
  • <FacFormat2>
  • Description: User Defined Format correlating to how you want Faction Messages to Display In-Game
  • "Example: [D-Fac]{p}"
  • [D-Fac] - Prefix (Adds in-front of the Username / ServerName in In-Game Chat
  • {p} - Player-Name
  • Values Accepted: Anything of Choice
  • <CommandPerms>
  • Description: TO BE CONTINUED
  • Values Accepted: