TelluriumMC / TelluriumChatBridge

Discord <-> ingame chat bridge for the Tellurium network.
MIT License
3 stars 0 forks source link

Overview

wakatime CodeFactor Mod loader: Fabric GitHub repo size GitHub GitHub last commit GitHub release (latest SemVer including pre-releases)

Server-side FabricMC mod featuring a Discord <-> Minecraft chat bridge for the Tellurium network, with multiple features not found in other chat bridge mods.

Built with JDA, Mineskin, and Oro-Config.

- This is my first time using Java, so this code might not have the best practices in it.

Contents

Features

Multiple Discord Channel Support

Broadcast messages from multiple Discord channels into Minecraft, from multiple different servers! This also features Discord to Discord chat bridging, so you won't miss a message. This also supports attachments! Upload images and files, and they will be sent through too, and if a message contains an attachment, this will show in Minecraft chat too!

image

Channel One ![channel-1](https://user-images.githubusercontent.com/45357714/130361056-ce889159-9815-4648-8259-1316671ae818.png)
Channel Two ![channel-2](https://user-images.githubusercontent.com/45357714/130361102-f9fce4bb-4d1e-4328-b8a3-5c37922f4664.png)

3d Head Rendering

Discord webhooks allow us to set our own avatar for each message, which means we can set them based on the player who talks. Thanks to Mineskin, we are able to generate a rendered image of the player's head.

image

Death Messages, Player Connections and Server Starting Announcements

Broadcast player death messages, join and leave messages, and server start/stop messages straight to Discord.

image

image*

image

*Discord formatting was broken in this screenshot. It has since been updated to _Skypie_ was shot by Skeleton

Discord Bot Commands

Commands to check the server's health (TPS, and MSPT), the current players online, and the bot's latency, are all prebuilt into the Discord bot.

image

image

image

Json Configuration

An automatically generating config file, with the ability to customize everything! See configuration below.

Console Logging

Logs all messages in the server console, as well as errors and initialization.

image

Setup

Configuration

Example configuration file:

{
  "tellurium_chat_bridge_config": {
    "discord_bot_token": "Bot token here",
    "server_name": "TMP",
    "discord_channel_ids": [
      "866299513476343962",
      "836222513389183949",
      "821686696895737887"
    ],
    "webhook_urls": [
      "https://discord.com/api/webhooks/821686696895737887/FQO9otfxTI6Ml7mMY6dt-5IpkS81KhYnvz-EgmcwfFm7G1_PNg8cvwAFOjD4QaVC_cdY",
      "https://discord.com/api/webhooks/866299513476343962/35kSpD_NjepvJ6WOXY9FAHZ1l7bWOUkxelyQieLPKUPtjjzXm4dwf7AdsNv45HIpPA2A"
    ],
    "discord_to_minecraft_formatting": "{player_name} §9§lD §r§8»§r {attachment} {text}",
    "bot_prefix": "!"
  }
}

(Yes, these webhook URLs are fake)


discord_bot_token - Your Discord bot token.

How do I get a Discord bot token? Go to https://discordapp.com/developers. Click `My apps` in the top left: ![img](https://i.imgur.com/msNDtLt.png) Click `New App`: ![img](https://i.imgur.com/zSTbluP.png) Give your bot a name and optionally a description and avatar: ![img](https://i.imgur.com/mwmIn1y.png) Click `Create App`: ![img](https://i.imgur.com/MbH7tX2.png) Scroll down and click `Create a Bot User`: ![img](https://i.imgur.com/G4L7X0l.png) Click `Yes, do it!`: ![img](https://i.imgur.com/Mdfar29.png) Click `click to reveal` nex to `Token:`: ![img](https://i.imgur.com/sOIvcXU.png)

server_name - The name of the server (for example SMP, CMP, etc).

discord_channel_ids - An array of Discord channel ids. Make sure to add a comma after each item.

webhook_urls - An array of Discord webhook URLs. Make sure to add a comma after each item.

discord_to_minecraft_formatting - Formatting for what Minecraft chat sees for Discord messages.

property use
{player_name} the author's name of the Discord message
{attachment} where <Attachment> shows when an attachment is sent through Discord
{text} the raw message that was sent to Discord

bot_prefix - The prefix that the bot uses when typing commands.

Commands

command alias use
ping ping Returns bot latency
online online, players, playing Returns current online players
health health, stats, tps, mspt Returns server health (tps & mspt)