How jack-avery/ansible-tf2network-relay works
This is a Discord bot that relays messages from configured Discord channels into Team Fortress 2 servers and provides /rcon and /servers slash commands. Its main workflow is Discord message handling, formatting and sanitization, then RCON dispatch; command interactions are dispatched to their handlers and returned as embeds. A background task refreshes server status for /servers. The README documents the required SourceMod plugin for displaying relayed messages; unsampled plugin-side wiring is not inferred.
Main entry points: main.rs Event handling · rcon.rs RCON command · servers.rs Servers command · state.rs Status refresh
Components 15
Bot runtime
- Event handling
src/main.rs - Message formatting
src/main.rs - RCON transport
src/main.rs - Command errors
src/error.rs
Slash commands
- RCON command
src/commands/rcon.rs - Servers command
src/commands/servers.rs
Server state
- Status refresh
src/state.rs - Host status cache
src/state.rs
Configuration
- Access configuration
src/config.rs - Server manifest
src/manifest.rs
Other components
- Discord users and gateway
- manifest.yml
- Environment variables
- TF2 servers
- SourceMod relay plugin
Connections 24
- Discord users and gateway → Event handling: sends events
- Event handling → Message formatting: handles messages
- Message formatting → RCON transport: sends relay command
- RCON transport → TF2 servers: executes RCON
- TF2 servers → SourceMod relay plugin: plugin displays relay
- Event handling → RCON command: dispatches command
- Event handling → Servers command: dispatches command
- Event handling → Access configuration: loads config
- Environment variables → Access configuration: provides RCON_USERS
- RCON command → Access configuration: checks access
- Event handling → Server manifest: loads manifest
- manifest.yml → Server manifest: provides server data
- Event handling → Status refresh: starts refresh
- Status refresh → Server manifest: reads host definitions
- Status refresh → TF2 servers: queries status
- Status refresh → Host status cache: updates status
- RCON command → Host status cache: looks up server
- Servers command → Host status cache: reads all status
- RCON command → TF2 servers: runs command
- RCON command → Command errors: returns failures
- Servers command → Command errors: returns failures
- RCON command → Event handling: returns embed or error
- Servers command → Event handling: returns embed or error
- Event handling → Discord users and gateway: replies with embed