Skip to content

Latest commit

 

History

History
184 lines (129 loc) · 7.77 KB

README.md

File metadata and controls

184 lines (129 loc) · 7.77 KB

TTTDiscordLink

Connect a Garry's Mod Server with a Discord Server!

Index

  1. Index
  2. Info
    1. What It Does
    2. How It Works
    3. Your Options
      1. Simple Way
      2. Advanced Way
  3. Additional Documentations
  4. Getting Started
    1. Install Garry's Mod Server Script
    2. Add The Discord Bot To Your Own Server
    3. Configurate The Discord Bot
    4. (OPTIONAL) Setup Own Discord Bot
      1. Using npm
      2. Using yarn
    5. (OPTIONAL) Setup Own Database And Webpage
  5. How To Basic
  6. ToDo
  7. FAQ
    1. Q: How do I get my token?
  8. Disclaimer

Info

What It Does

When you die in Garry's Mod Trouble in Terrorist Town, you normally are not allowed to speak anymore. You will be muted automatically in game and can't talk anymore until you respawn. Since some people use Discord as an alternative voice chat with higher quality the in game voice chat is less in use. In Discord you have to mute yourself or be silent "manually" to avoid disturbance. TTTDiscordLink is a setup that connects your Garry's Mod server and your Discord server to automatically mute players who die and unmute them when they get revived or respawn.

How It Works

Basically there are three components that work together to make the magic happen:

  • The Garry's Mod server script
  • The webpage & database
  • The Discord bot

And this is how they work together:

  1. When someone dies or respawns in game the server script will send a request to my (or your) webpage including the info which player to target and whether to mute or unmute them.
  2. The webpage will edit the specific table corresponding to your Discord server which was created by the Discord bot.
  3. The Discord bot will periodically check if a player has to be muted or unmuted by observing the database.

Your Options

Whether you want a quick setup using my service or want to setup everything by yourself you have two options:

1. Simple Way

2. Advanced Way

  • Install the server script.
  • Setup your own Discord bot.
  • Add your own Discord bot to your Discord server.
  • Configurate the Discord bot.
  • Setup your own database and webpage.

Additional Documentations

Here are a couple of additional documentations that may help you.

Getting Started

Install Garry's Mod Server Script

  1. Move TTTDiscordLink.lua to GMOD_SERVER_DIRECTORY/garrysmod/garrysmod/lua/autorun/server.
  2. Insert your Discord server ID into the quotation marks at local DiscordID = "".
  3. Insert your token you received from the Discord bot into the quotation marks at local Token = "".
  4. Restart your Garry's Mod server.
  5. [OPTIONAL] Only if you want to use your own Discord server & database:
    • Change the URL in the quotation marks to your own URL pointing to TTTDiscordLink.php at local Webpage = "https://old.zlyfer.net/sites/games/gmod_ttt/TTTDiscordLink.php".

Add The Discord Bot To Your Own Discord Server

  1. Use this link to add my bot TTTDiscordLink to your Discord server: Discord Bot Invite.
  • Keep in mind that the bot needs following rights: MUTE_MEMBERS and VIEW_CHANNEL.
  • The permission for SEND_MESSAGES is not mandatory but extremely recommended!
  • See Discord Bot Permissions for reference.
  1. Upon invitation the bot will send you a token. As mentioned, you need to insert this token inside of TTTDiscordLink.lua.

Configurate The Discord Bot

Every player has to tell the bot which SteamID64 they have.

Basically you have to use the command ~zltd~link [SteamID64] to link your DiscordID with your SteamID64 so the bot can mute you when you die.

I made an in depth tutorial which should help on how to access your SteamID64 and how to properly link it with your DiscordID.

(OPTIONAL) Setup Own Discord Bot

  1. Rename token_template.json to token.json and insert your Discord bot token into the quotation marks.
  2. Rename db_config.template.json to db_config.json and add your database credentials.
  3. Install bot dependencies and start the bot.

Using npm

npm install
npm start

Using yarn

yarn install
yarn start

(OPTIONAL) Setup Own Database And Webpage

  1. Move TTTDiscordLink.php to a directory on your webserver. Make sure it is exactly where local Webpage in TTTDiscordLink.lua is pointing to.
  2. Fill in your database credentials using the variables in TTTDiscordLink.php.
  3. Create a database called 'TTTDiscordLink' and invite your Discord bot to your Discord server.
  • If you already invited the bot to the server simply restart the Discord bot.

How To Basic

If you don't know how to make your own Discord bot, install npm or similar you should stick to the Simple Way.

In case you want to use the Advanced Way anyway the links below might help you but please read the Disclaimer first.

ToDo

  1. Switch from botPrefix + command messages to /commands.

FAQ

Q: How do I get my token?

  • In case you didn't receive a token when you invited the Discord bot to your Discord server you can use the command ~zltd~token to generate a new token.

Disclaimer

About The Advanced Way

The links and tutorials are quickly searched in a haste. I am not responsible if you mess anything up but you can always open an issue if you have questions. In case you are unsure or worried, please use the Simple Way as mentioned.

General Use Of TTTDiscordLink

The bot will be able to server-side un/mute people on your discord server!

At the moment everyone can mute people on your Discord server if they know it's ID and the SteamID64 of a specific person on your Discord server (if linked in database). - Tokens are now a thing!