Skip to content
🌉 A Discord <-> Terraria bridge plugin for TShock
C#
Branch: master
Clone or download
ldilley Merge pull request #45 from ldilley/master
Add mention and custom emote conversion
Latest commit 564c0f1 Jan 17, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
Terracord Fix Code Climate complexity findings Jan 17, 2020
TerracordTest Add Mono comment [skip ci] Jan 16, 2020
.codeclimate.yml Refactor all the things Jan 6, 2020
.gitignore Add .gitignore Dec 27, 2019
.travis.yml Add Travis notification to Discord Dec 28, 2019
LICENSE.txt
Terracord.sln Add preliminary xUnit test support Jan 16, 2020
appveyor.yml
terracord.xml Fix FxCop analyzer warnings and add localization support Jan 16, 2020

README.md

AppVeyor build status Travis CI build status Code Climate maintainability CodeFactor grade Discord

Terracord

Terracord is a Discord <-> Terraria bridge plugin for TShock. The plugin enables the bi-directional flow of messages between a Discord text channel and a TShock server. This project is inspired by DiscordSRV which is a Discord <-> Minecraft chat relay plugin for PaperMC and Spigot.

Terracord is written in C# and is licensed under the terms of the GPLv3. This project makes use of Discord.Net and the Terraria API.

Installation

  1. Simply copy Terracord.dll and its dependencies into your TShock ServerPlugins directory. The dependencies should be contained in any release zip archive and includes the following files: Discord.Net.Core.dll, Discord.Net.Rest.dll, Discord.Net.WebSocket.dll, Newtonsoft.Json.dll, System.Collections.Immutable.dll, and System.Interactive.Async.dll. Ensure that the version of Newtonsoft.Json.dll copied to the ServerPlugins directory is >=11.0.2. This is a required dependency of Discord.Net. The instance of this DLL included with TShock 4.3.26 is older (10.0.3) and using it results in not being able to establish a connection to a Discord server.

  2. Edit terracord.xml to set your bot token and Discord channel ID. This file should be saved to the tshock directory. Other settings in this configuration file may also be changed to your liking. The channel ID can be obtained by enabling developer mode in your Discord application and then copying the ID of the relevant text channel you want to relay Terraria messages to. A channel ID appears as a long string of numbers. The process is described here. In order to obtain a bot token, you will need to create a Discord bot application. The process is described here.

  3. Restart your TShock server to load the plugin. For review or troubleshooting purposes, terracord.log can be found in the tshock directory.

⚠️ Unfortunately, Terracord may not work with Mono. This is due to Discord.Net not supporting Mono.

Building

Visual Studio

  1. Download and install Visual Studio if you do not have the software. The community edition is free and contains the essentials to build Terracord. In particular, you want the ".NET desktop development" workload. The "NuGet package manager" is also required to pull in the Discord.Net dependencies. Other individual components such as debuggers, profilers, "Git for Windows", and the "GitHub extension for Visual Studio" may be useful.

  2. Obtain a copy of the Terracord source code if you have not already. This can be performed with git clone https://github.com/FragLand/terracord.git. You may alternatively download a zip archive of the source and extract the contents to an arbitrary location.

  3. Download the release archive of TShock.

  4. Create a directory named lib at the same path where Terracord.sln resides.

  5. Extract OTAPI.dll, TerrariaServer.exe, and TShockAPI.dll from the TShock zip archive and then place these 3 files under the lib directory you recently created during step 4.

  6. Open Terracord.sln using Visual Studio.

  7. NuGet should automatically download Discord.Net and its dependencies based on Terracord.csproj. If not, you can manually install Discord.Net.Core and Discord.Net.WebSocket via NuGet. You may also attempt to right-click the solution in the "Solution Explorer" of Visual Studio and then left-click "Restore NuGet Packages".

  8. Use Build->Build Solution or ctrl+shift+b to build Terracord.

  9. If all goes well, you should have a shiny new Terracord.dll at the path referenced in the build output. Enjoy!

.NET Core

  1. Install .NET Core SDK. .NET Core SDK 3.1.100 is known to successfully build Terracord. You can also configure various Linux package managers to install .NET core. This has the added benefit of being able to easily update the software.

  2. Obtain a copy of the Terracord source code:

    git clone https://github.com/FragLand/terracord.git

    Or:

    wget https://github.com/FragLand/terracord/archive/master.zip && unzip master.zip

  3. Download and extract TShock:

    wget https://github.com/Pryaxis/TShock/releases/download/v4.3.26/tshock_4.3.26.zip && unzip tshock_4.3.26.zip

  4. Create a directory named lib at the same path where Terracord.sln resides:

    mkdir terracord/lib

  5. Copy OTAPI.dll, TerrariaServer.exe, and TShockAPI.dll to lib:

    cp OTAPI.dll TerrariaServer.exe ServerPlugins/TShockAPI.dll terracord/lib

  6. Install dependencies:

    cd terracord

    dotnet restore

  7. Begin build:

    dotnet build -c <Debug|Release>

  8. You should now have a Terracord.dll.

Mono

⚠️ As mentioned previously, loading Terracord.dll with Mono may not work considering Discord.Net does not support this. Therefore, the following steps should be considered experimental.

  1. Install Mono and NuGet. Under Debian, this can be achieved via:

    apt-get install mono-complete nuget

  2. Obtain a copy of the Terracord source code:

    git clone https://github.com/FragLand/terracord.git

    Or:

    wget https://github.com/FragLand/terracord/archive/master.zip && unzip master.zip

  3. Download and extract TShock:

    wget https://github.com/Pryaxis/TShock/releases/download/v4.3.26/tshock_4.3.26.zip && unzip tshock_4.3.26.zip

  4. Create a directory named lib at the same path where Terracord.sln resides:

    mkdir terracord/lib

  5. Copy OTAPI.dll, TerrariaServer.exe, and TShockAPI.dll to lib:

    cp OTAPI.dll TerrariaServer.exe ServerPlugins/TShockAPI.dll terracord/lib

  6. Install dependencies:

    cd terracord

    nuget restore Terracord.sln

  7. Begin build:

    xbuild /p:Configuration=<Debug|Release> Terracord.sln

    Or:

    msbuild /p:Configuration=<Debug|Release> Terracord.sln

  8. With luck, a wild Terracord.dll will appear.

Contributing and Support

Feel free to submit an issue if you require assistance or would like to make a feature request. You are also welcome to join our Discord server at https://discord.frag.land/. Any contributions such as plugin testing and pull requests are appreciated. Please see the fork and pull guide for direction if you are not certain how to submit a pull request.

You can’t perform that action at this time.