Garry's Mod

Garry's Mod

74 ratings
Discord Muter
3
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: ServerContent
Addon Tags: Fun, Roleplay, Realism
File Size
Posted
Updated
85.893 KB
5 Jul, 2020 @ 10:24am
19 Jun, 2021 @ 4:09pm
9 Change Notes ( view )

Subscribe to download
Discord Muter

In 3 collections by Manix84
[TTT] DVWeb Server Content
80 items
[Murder] DVWeb Server Content
7 items
[TTT2] DVWeb Beta Server Content
50 items
Description
Mute players in your Discord server, after they die.

Works for TTT, TTT2, and Murder.

But why?
We all have that friend that likes to shout the name of their killer after they die. It's no fun for anyone involved. This mod lets you cut their mic for a few seconds or, until the round ends. Which-ever suites your team. After about 5-10 seconds, they've usually calmed down and they can re-join to laugh at what's happening.

Features
  • Works in Trouble in Terrorist Town (and TTT2: Advanced Update), and Murder.
  • Remote Node Bot (the node bot and the add-on don't need to be on the same server, but they can be if you want).
  • Secure & Authenticated connection, so no-one should be hijacking your bot communication.
  • Discord Server link. When someone connects, they get told to join your server, if they're not already connected.
  • Mute a Player for the entire round, or simply for a few seconds.
  • Multilingual support - running a non-English server, then this option is for you. (User-submissions welcomed)
    • English
    • German
    • Turkish (by Ozanky)
    • French (by MoskalykA[github.com])
    • Spanish (by Santikun[github.com])
    • Pirate - I got bored one evening
  • Automatically connect players when they join your server. If a new player joins, they're on the Discord server already, and use the same name, they'll get connected without even prompting them.
  • ULX Support:
    • Added (Un)Mute in commands menu - Obviously, you can mute and un-mute a player from the ULX menu
    • Added Discord Settings
      • "Settings" - You can change any of the Console Variables on a per Map basis.
      • "Player Connections" - You can add a Steam/Discord ID connection from the ULX menu.
  • Node Bot "KeepAlive". Some bot hosts kill the bot if they don't get connections after a while. This option will keep the bot running, between sessions.

Requirements
I can't stress this enough, you need to setup the Node Bot[github.com]. Without the Node Bot, the mod can't talk to your Discord server.

Getting Setup
Setting up the bot... Hopefully these will be helpful to some.
  1. Fork the Node Bot in Github
  2. Create an account on https://signup.heroku.com/ (It's free)
  3. Create an App...
    • Goto: https://dashboard.heroku.com/new-app
    • App Name: Use a name like [serverName]-discord-bot. This name will be used for the server name, EG: [serverName]-discord-bot.herokuapp.com.
  4. Connect To Github: Fill this section in, so that the pipeline is pulling in /discord_gmod_bot
  5. Add "heroku/nodejs" buildpack.
  6. Setup Config Vars
    • API_KEY: This MUST match the GMod server. It can be anything.
    • DISCORD_GUILD: A copy of the Server/Guild ID.
    • DISCORD_CHANNEL: A copy of the Voice Channel ID.
    • DISCORD_TOKEN: This allows the Discord Bot and the Node Bot to communicate.
      • To get the DISCORD_TOKEN, you'll need to create a Discord Bot[github.com]. You'll need to follow these instructions to invite the bot, into your server.
    • KEEPALIVE_ENABLED: 1 - This will keep your bot online between sessions.
    • KEEPALIVE_HOST: The host name for your bot (EG: [serverName]-discord-bot.herokuapp.com)
    • KEEPALIVE_PORT: The host port. Probably "443".
If you're struggling to get the Discord Guild/Channel ID, Discord have a guide[support.discord.com] to getting the ID's.

ConsoleVariables
(Those variables that live in /garrysmod/cfg/server.cfg

Variable
Optional/Default
Description
discord_endpoint
The location of your Discord Node Bot. If you are running them on the same machine, you shouldn't need to set this.
discord_api_key
(optional)
The authorisation key Discord Node Bot. This is essential if you're running the node bot on another machine. It must also match, exactly, the API key set for the Node Bot.
discord_name
Discord
The prefix displayed to your players when the add-on sends them a message (EG: [Discord] You've been muted until the end of the round.)
discord_server_link
The discord invite shown to players when they connect for the first time. (EG: [Discord] Join the discord server - https://discord.gg/yg6KJ8c/)
discord_mute_round
1
Should a players be muted until the round ends? (1=Yes, 0=No)
discord_mute_duration
5
How many seconds should a player be muted after death? (has no effect if discord_mute_round is enabled)
discord_auto_connect
0
Should the add-on try to match the Steam Nickname to the Discord Nickname of a player? (1=Enabled, 0=Disabled)
discord_language
"english"
Let's you specify the language the player sees. (Available Languages[github.com])
discord_debug
0
Shows all the debug messages used to help build and maintain the add-on. (1=Enabled, 0=Disabled)
*Please remember to wrap your URL's in quotes, because the // part of the URL will be treated as a comment.

Support
I'm aware that setting up a Node Bot isn't the easiest thing to do, so I've been working hard recently to add error messages, and status messages into the Bot and the Addon to help self-service repairs.

This might not solve all of the issues, so I setup a Discord server specifically to help anyone that's struggling. You can join via https://discord.gg/yg6KJ8c. I'm always happy to help, even if it takes me a while to reply.

Credits
This mod did start off life as TTT Discord Bot, which was written by marcel, before I quickly realised that I'd made so many changes that pushing my code back into the original repository would be virtually impossible. A quick diff between the two projects showed only "end"'s that were left over, so some of the basic structures exist, but not much else... sorry.

If Marcel, or anyone else has a problem with me uploading this version, please drop me a line and I'll take it down. I'm just pretty proud of what I accomplished, as I'd never touched Lua (or GLua) until about 4 weeks ago, and I a lot of people were asking me to share it.

The Source Code
Popular Discussions View All (3)
1
17 Mar, 2022 @ 12:55am
PINNED: Bug Reports
Manix84
0
13 Jul, 2020 @ 5:20am
PINNED: Troubleshooting
Manix84
0
6 Jul, 2020 @ 9:34am
PINNED: Feature Requests
Manix84
20 Comments
ruby0b 17 Mar, 2022 @ 9:58pm 
Just wanted to note that if you're using localhost to run the bot, you'll have to launch the server with the -allowlocalhttp parameter (see this note in the docs [wiki.facepunch.com] ).
Broke my Profile 24 Jun, 2021 @ 12:26pm 
Burn it down to the ground and consume the ashes and shat it out for nature to collect it and remove it's remaining particles.
Manix84  [author] 5 Feb, 2021 @ 10:18am 
Okay, some heads up. I'm working on a v2 of the Discord Muter. I'm not sure when it'll be ready, so you should still use this one, but my proposed feature list looks a little like this...

- A Centralised Bot, in Discord Bots - Basically, one of the main aims of Discord Muter 2.0 will be to get rid of the "Setup your own bot" part of the instructions. The bot will still be open source, so that you can host your own if you care. This is because it's the issue I'm asked about the most, by far.
- More options with the Bot in the Discord channel - Obviously we're going to need a level of security, so the two way Auth code will move to the bot.
- Move to Dead Player Channel, not just mute - I've looked into it, it's entirely doable - Thanks Jackson1, awesome idea.

Anyway. If anyone has any other features they'd like to see from v2.0, let me know, I'm happy to add it to the list. Obviously the primary features come first, but new features can always be added as I go along.
o Jackson 1 o 27 Jan, 2021 @ 7:17am 
No worries, thanks for getting back to me!
Manix84  [author] 27 Jan, 2021 @ 6:10am 
Sorry @jackson1, I thought I'd replied to this ages ago.

I'm going to look into adding a mechanism that would move the players to a different channel when they died. That's the only mechanism that would allow dead players to talk. This is a limitation of Discord.

Feel free to join the Discord Server [discord.gg] if you want to discuss it further.
o Jackson 1 o 2 Oct, 2020 @ 10:53am 
Awesome, thanks! I just think it would work a bit more like the native GMOD TTT voice chat that way, with dead players still being able to talk to each other instead of sitting on mute for 5 minutes. Cheers!
Manix84  [author] 27 Sep, 2020 @ 1:17pm 
@LuckyTiger, can you join the discord help channel, and I'll try to help walk you through it.

@Jackson 1, I can certainly look into it. I've not thought of that before, but I can look at how the API for Discord.js works, and see if it supports moving players to new rooms. Feel free to join the discord channel, or watch the GitHub repo for updates.
o Jackson 1 o 27 Sep, 2020 @ 8:32am 
Thanks for the addon, gonna try this out soon as I couldn't get Marcel's version to work. Do you think instead of muting players, it would be possible to move them from one voice channel to another? i.e. The server sets up a "Dead" channel, and once killed, the bot moves them from main chat to "Dead" and then back again once the round ends. I know it's probably a lot of work to make it happen (plus Discord would give an audio alert when a player leaves/rejoins, but could be disabled manually), but it would be cool to have the option to either mute or move, maybe as an additional convar or something.
LuckyTiger 26 Sep, 2020 @ 6:32pm 
How do you add "heroku/nodejs" buildpack? I'm on step 4 and have it connected to my GitHub but I don't quite understand how to add the pack.
Manix84  [author] 17 Aug, 2020 @ 7:38am 
@Aleuvian Very strange. If you get a moment, can you jump on discord to work through it with me?