A SourceMod plugin that syncs chat between your Source Engine server and Discord.
Players can talk with Discord users directly from in-game, while Discord messages appear in chat with nicknames and role colors.
Images courtesy of boba
- Two-way chat sync: Game ↔ Discord messages in real time
- Mentions: Handles user, role, and channel mentions seamlessly
- Steam profile integration: Player avatars and configurable Steam ID formats
- Server event logs: Join/leave notifications for players
- Caching system: Fast lookups for avatars, nicknames, role colors, etc.
| Game | Status | Notes |
|---|---|---|
| Team Fortress 2 | ✅ Tested | Designed for TF2, works flawlessly |
| Half-Life 2: Deathmatch | ✅ Tested | Includes any mod based on Source SDK 2013 |
| Counter-Strike: Source | ✅ Supported | 64-bit only |
| Left 4 Dead 2 | ✅ Supported | 64-bit only |
| Insurgency | ✅ Supported | 64-bit only |
| Counter-Strike: Global Offensive | Deprecated; last CS:GO server builds only | |
| Day of Defeat: Source | ❌ Unsupported | Incompatible with SourceMod 1.12+ |
| Garry's Mod | ❌ Incompatible | Not officially supported |
SourceCord should work with any Source Engine game that supports SourceMod 1.12+.
If you encounter issues, please file a bug report.
- SourceMod: Version 1.12 or higher
- REST in Pawn: For HTTP requests to Discord API
- Discord Bot: Bot token with appropriate permissions
- Steam API Key: For fetching player profile information
- Install the REST in Pawn extension on your server
- Download the latest
sourcecord.smxfrom releases - Place
sourcecord.smxinaddons/sourcemod/plugins/ - Load the plugin with
sm plugins load sourcecord(it will auto-create both config files) - Edit
cfg/sourcemod/sourcecord.cfgto set your preferred settings - Edit
addons/sourcemod/configs/sourcecord.cfgto add your credentials - Restart the plugin with
sm plugins reload sourcecord
On first load, the plugin generates cfg/sourcemod/sourcecord.cfg with default settings.
Edit this file with your preferred settings:
sc_interval "1.0" // Check Discord messages every x second(s)
sc_log_connections "1" // Log player connections (0 = off, 1 = basic, 2 = with IP)
sc_use_role_colors "1" // Show Discord role colors in-game? (enabled by default)
sc_use_nicknames "1" // Use Discord server nicknames? (enabled by default)
sc_show_steam_id "1" // Show Steam ID format (0 = off, 1 = steamID3, 2 = steamID)
sc_show_discord_prefix "1" // Show [Discord] prefix in chat messages? (enabled by default)
sc_discord_color "5865F2" // Hex color for Discord usernames in game chat (blurple by default)The plugin will also generate addons/sourcemod/configs/sourcecord.cfg to store your credentials.
"SourceCord"
{
"Discord"
{
"bot_token" "" // Discord Bot token
"channel_id" "" // Discord channel ID
"guild_id" "" // Discord guild/server ID
"webhook_url" "" // Discord Webhook URL
}
"Steam"
{
"api_key" "" // Steam API key
}
}- Go to the Discord Developer Portal
- Create a new application and bot user
- Copy the bot token and add it to your
configs/sourcecord.cfgfile asbot_token
- In the Discord Developer Portal, go to your bot's Bot settings page
- Scroll down to Privileged Gateway Intents
- Enable these intents:
- Server Members Intent: Required for fetching member nicknames and role information.
- Message Content Intent: Required to read the actual content of Discord messages.
- Save changes.
- View Channels: Needed to see the configured channel and resolve mentions
- Read Message History: Needed to fetch/catch up on messages
Use this URL to invite your bot to your server with the required permissions (replace <YOUR_BOT_CLIENT_ID>):
https://discord.com/api/oauth2/authorize?client_id=<YOUR_BOT_CLIENT_ID>&permissions=66560&scope=bot
⚠️ This only sets permissions - you also need to enable the required intents in Step 2.
- In your Discord channel, go to Edit Channel → Integrations → Webhooks
- Create a new webhook (optionally set a default avatar)
- Copy the webhook URL and add it to
configs/sourcecord.cfgaswebhook_url
- Developer Mode: User Settings → Advanced → Developer Mode → Enable
- Channel ID: Right-click channel → Copy Channel ID (add to
configs/sourcecord.cfgaschannel_id) - Guild ID: Right-click server name → Copy Server ID (add to
configs/sourcecord.cfgasguild_id)
- Generate a Steam API key from the Steam Web API
- Add it to
configs/sourcecord.cfgasapi_key
Edit these settings in cfg/sourcemod/sourcecord.cfg to customize SourceCord to your liking.
Control Steam ID format in both Discord messages and connection logs:
- Disabled (
sc_show_steam_id 0):
- SteamID3 Format (
sc_show_steam_id 1):
- SteamID Format (
sc_show_steam_id 2):
⚠️ Note: Steam IDs will appear in chat messages and connection messages when enabled.
Control what information appears in connect/disconnect messages:
-
Disabled (
sc_log_connections 0):- No connect/disconnect messages sent to Discord
-
Basic Logging (
sc_log_connections 1):
- IP Logging (
sc_log_connections 2):
Control whether the [Discord] prefix appears in game chat:
- Enabled (
sc_show_discord_prefix 1):
- Disabled (
sc_show_discord_prefix 0):
Customize the default color of Discord usernames in game chat:
- Default: (
sc_discord_color "5865F2"):
- Custom: (
sc_discord_color "EF0988"):
⚠️ Note: When Discord role colors are enabled (sc_use_role_colors 1), user role colors take precedence oversc_discord_color.
- SourceMod compiler (
spcomp) - REST in Pawn includes
# Clone repository
git clone https://github.com/johnqherman/SourceCord.git
cd SourceCord
# Copy files to SourceMod's scripting directory
cp sourcecord.sp /path/to/addons/sourcemod/scripting/
cp -r sourcecord/ /path/to/addons/sourcemod/scripting/
# Compile the plugin
cd /path/to/addons/sourcemod/scripting/
spcomp sourcecord.sp







