Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 27, 2025

This PR implements a private games feature for the casino games system, allowing users to create invitation-only games that prevent direct joining.

🎮 Overview

Private games provide a way for users to create exclusive gaming sessions where only invited players can participate. This addresses the need for more controlled gaming environments while maintaining all existing casino functionality.

✨ Key Features

Private Game Creation:

  • Added optional private parameter to the /game slash command
  • Usage: /game blackjack seats:4 private:true

Enhanced UI Experience:

  • 🔒 Private games display a lock icon and "(Private)" indicator in the title
  • Orange border styling to visually distinguish from public games
  • User select menu replaces the "Join Game" button for invitation-based access
  • Clear messaging about invitation-only access

Invitation System:

  • Only players already in the game can invite others via the user select menu
  • Invited users are automatically added to the player list but marked as "not ready"
  • Invited players must manually ready up to start the game
  • Invited users can leave the game normally using existing functionality
  • Comprehensive validation prevents duplicate invitations and capacity overflow

🔧 Technical Implementation

Core Architecture Changes:

  • Added IsPrivate property to GameSession class and IGameSession interface
  • Extended all game constructors to accept the isPrivate parameter
  • Updated GameService.CreateGameSession() to handle private game creation
  • Modified UI generation in DiscordGameSession to show appropriate controls

New Interaction Handler:

  • InviteUser component interaction processes user selections from the select menu
  • Integrates with existing casino token validation system
  • Provides clear feedback for successful invitations and error cases

Validation & Security:

  • Access control ensures only game participants can send invitations
  • Prevents inviting users already in the game
  • Validates game capacity before processing invitations
  • Ensures invited users meet token requirements
  • Restricts invitation functionality to private games only

🎯 Usage Examples

Creating a private game:

/game poker seats:5 private:true

Public vs Private Game Behavior:

  • Public games: Anyone can click "Join Game" to participate immediately
  • Private games: Only existing players see a user select menu to invite others

📸 Visual Changes

Private Games UI Comparison

The screenshot above shows the clear visual distinction between public and private games, with the private game featuring the lock icon, different styling, and user select menu for invitations.

🧪 Testing

Comprehensive validation ensures the feature handles edge cases properly:

  • Public games cannot use the invitation system
  • Non-players cannot access invitation functionality
  • Duplicate and capacity-exceeding invitations are prevented
  • Game state integrity is maintained throughout the invitation process

This implementation seamlessly integrates with the existing casino system while providing the requested private gaming functionality.

Fixes #354.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Pierre-Demessence <1756398+Pierre-Demessence@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Private games Implement private games feature for casino games Jul 27, 2025
@Copilot Copilot AI requested a review from Pierre-Demessence July 27, 2025 15:06
Copilot finished work on behalf of Pierre-Demessence July 27, 2025 15:06
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.

Private games
2 participants