Skip to content

Add rustplus_bridge cog with FCM push notifications for Discord-Rust+ chat bridge#56

Draft
Copilot wants to merge 9 commits intomainfrom
copilot/add-rustplus-cog
Draft

Add rustplus_bridge cog with FCM push notifications for Discord-Rust+ chat bridge#56
Copilot wants to merge 9 commits intomainfrom
copilot/add-rustplus-cog

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 16, 2025

Implements bidirectional chat bridge between Discord channels and Rust+ in-game team chat. Supports both polling and Firebase Cloud Messaging modes to eliminate constant API polling.

Implementation

Core Bridge

  • Bidirectional message forwarding with automatic reconnection (exponential backoff, 60s max)
  • Memory-bounded message deduplication (cleanup at 1000 entries → 500 retained)
  • Discord messages prefixed with username, Rust messages rendered as embeds with Steam ID

Dual Operation Modes

  • Polling mode (default): Configurable 1-60s interval, no additional credentials required
  • FCM mode (optional): Real-time push notifications via Firebase Cloud Messaging, eliminates polling overhead

Configuration Commands

[p]rustbridge setup <ip> <port> <player_id> <player_token>  # Basic credentials
[p]rustbridge fcm <json_credentials>                         # Optional FCM setup
[p]rustbridge pollinterval <seconds>                         # Adjust polling (non-FCM)
[p]rustbridge status                                         # Shows connection/FCM state

Technical Details

  • Async throughout, daemon-threaded FCM listeners with proper cleanup
  • Config-persisted credentials, runtime connection/task state management
  • Graceful degradation: FCM failures auto-fallback to polling
  • Closure capture for guild_id in FCM event handlers prevents reference issues

Dependencies: rustplus>=6.0.0

File Structure:

  • rustplus_bridge/rustplus_bridge.py - Main cog (750 LOC)
  • rustplus_bridge/README.md - Setup, troubleshooting, technical docs
  • .github/copilot-instructions.md - Updated with cog details
Original prompt

Create a new cog for rustplus.
This cog should support connecting to a server, and listening for team chat messages and creating a bridge between discord, so that messages in game are sent to discord, and messages in discord and sent ingame.

Note that there should be a method in discord for a user to submit their rustplus credentials so that the cog can correctly subscribe.

Context on rustplus - https://github.com/olijeffers0n/rustplus

A similar bot https://github.com/alexemanuelol/rustplusplus though this is made with javascript and i need it made in python.

Make sure to handle the connection and any memory leaks


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 8 commits December 16, 2025 00:03
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add rustplus cog for server connection and chat bridge Add rustplus_bridge cog with FCM push notifications for Discord-Rust+ chat bridge Dec 16, 2025
Copilot AI requested a review from psykzz December 16, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants