Skip to content

About

A self-hosted Discord bot for relaying chat messages between Discord and your GMod server, with support for multiple servers.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GM-DiscordRelay

A Discord bot that relays messages bidirectionally from and to your GMod server. Unlike most relays this one doesn't require any binary modules installed on your GMod server. image

It can also show your server's status.

image

Features

  • Relay in-game chat and other messages from multiple servers.
  • Relay discord messages to your GMod server.
  • Execute RCON commands from discord.
  • Show live server status on a designated channel.

Requirements

  • A GMod server with RCON and logging working properly and this addon installed.
  • Node.js v16 or higher.

For developers

The relay also supports sending custom messages from your GMod server. This can be useful for implementing gamemode specific functionality to the relay. In order to send a custom message you can use the SendRelayMessage(string,string) function. Example usage:

SendRelayMessage("Custom Username","Any message")

Result:

image

Installation

Setting up the bot itself.

  1. Head over to the Discord Developer Portal.
  2. Press the "New Application" button and name the bot however you like.
  3. Go to the "Bot" tab and check the "Message Content Intent" option, then click "Save changes". image
  4. Go to "Installation" and copy the "Install Link". image
  5. Paste the link into your address bar and add this snippet of text at the end &permissions=536938560&scope=bot and hit Enter. image
  6. Add the bot to your server.
  7. After adding the bot to your server, go back to your bot's page and enter the "Bot" tab of your bot.
  8. Click the "Reset Token" button and then copy the newly generated token.

image

  1. Save the token for later, as you will need it in later steps.
  2. Head over to (https://steamcommunity.com/dev/apikey).
  3. Create an API key and then copy and save it for later.
  4. Clone this repository with the git clone https://github.com/Dorian399/GM-DiscordRelay.git command.
  5. Go to the repo's main directory. (cd "GM-DiscordRelay").
  6. Run npm install to install all the required dependencies.
  7. Edit the config.cjs file in a text editor and configure everything to your liking.
  8. If you have any trouble figuring what to put as the channel ID's or User ID's, you can follow this guide to find those.
  9. Everything is set up, you can launch the bot using node index.js.

Note: Ensure that the relay’s port only accepts connections from your server and is blocked for all other external traffic in your firewall.

Setting up the GMod server.

  1. Open your server.cfg in a text editor.
  2. Add these commands to your server.cfg:
log on
logaddress_add IP:PORT
sv_logecho 0

The IP and PORT values should be changed to the ip and port your bot is hosted on.

  1. If you don't have an RCON password set, you can set it by adding rcon_password yourpassword to your server.cfg file.
  2. Save and exit the server.cfg file.
  3. Go to your server's addons folder.
  4. Download the required addon using this command: git clone https://github.com/Dorian399/gm_discordrelay_addon.git.
  5. Everything is set up, you can start your GMod server.

About

A self-hosted Discord bot for relaying chat messages between Discord and your GMod server, with support for multiple servers.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages