Discord ⇄ Server interaction for the Source Engine
Place discordrelay.smx inside of ./cstrike/addons/sourcemod/plugins
and update convars in ./cstrike/cfg/sourcemod/discordrelay.cfg
after running the plugin.
SteamWorks - https://forums.alliedmods.net/showthread.php?t=229556
discord-api - https://github.com/Cruze03/sourcemod-discord
*Note - If you plan to send messages/requests to the server from discord ensure you have Message Intents enabled in the app dashboard. [^1] [^1]: Thank you ampere. Image provieded by dysphie.
ripext (sourcemod REST api) - https://forums.alliedmods.net/showthread.php?t=298024
This will be your steam API key which you can find at https://steamcommunity.com/dev/apikey. The key is used to grab the client's steam avatar.
Your discord bot token found/created by going to https://discord.com/developers/applications, creating an application, creating a bot, and copying the bot token. You do not need the bot to be running, just having it in your server will work.
Set this to your Discord channel's webhook url. You can create one by going to your Discord server, entering a text channel's settings, then in integrations create a webhook and copy the url.
Enable Developer Mode in Discord, right click on the server name in the top left and click Copy ID. Required for communication between Discord and Source.
Enable Developer Mode in Discord, right click on the channel name and click Copy ID. This is the channel messages will appear in.
Enable to allow messages sent in the server to be sent through discord via webhook.
Enable to allow messages sent in discord to be sent to the server.
Change avatar in messages sent to Discord to the client's Steam avatar. Requires a valid Steam API key.
Send client connection messages to Discord.
Send client disconnection messages to Discord.
Send map change messages to Discord.
Enable to allow client messages in the server to be sent to Discord. This is any message thats not a command, only exception is any ! command which can be hidden by enabling discrelay_hideexclammessage.
Hides any message that begins with ! or /, discrelay_message needs to be enabled for this to work.
("%s[%sDiscord%s] %s%s%s#%s%s%s: %s", g_msg_textcol, g_msg_varcol, g_msg_textcol,
g_msg_varcol, discorduser, g_msg_textcol,
g_msg_varcol, discriminator, g_msg_textcol,
message)
discorduser, discriminator, and message are discord things, but g_msg_textcol and g_msg_varcol refer to the colors used for the message that will be sent to the server when doing discord -> server. The plugin uses morecolors.inc to supply the colors, so when setting the cvar make sure to set it like {red} for example. Depending on the game you are using different options to set the color can be chosen such as using hex (more information here https://forums.alliedmods.net/showthread.php?t=247770).
Print bans, if SBPP is installed on the server.
Print gags, mutes, and silences, if SBPP is installed on the server.
URL to an image. Used to change the avatar of the SBPP messages.
Enable RCon functionality.
Discord channel ID for where rcon commands should be sent.
Prints server response to the command.
Webhook for RCon reponse.