Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Guild groups are currently deleted when Discord guilds are removed or orphaned. This loses historical data and prevents recovery. Instead, mark groups as inactive for potential future restoration.

Implementation

Metadata tracking:

  • Added Inactive bool and InactiveReason string to GroupMetadata
  • Added InactiveGroupNamePrefix = "[INACTIVE] " constant for visual identification

Core functions:

// Mark a guild group as inactive with a reason
func MarkGuildGroupInactive(ctx, nk, groupID, reason string) error

// Check if a group is inactive (by prefix or metadata)
func isGuildGroupInactive(group *api.Group) bool

Refactored deletion points:

  • handleGuildDelete() - marks groups inactive with reason "Discord guild deleted"
  • pruneGuildGroups() - marks orphaned groups inactive with reason "Orphaned group - bot not in Discord guild"

Filtering:

  • GuildGroupsLoad() - filters out inactive groups
  • GuildGroupLoad() - returns error for inactive groups
  • GuildUserGroupsList() - filters out inactive groups
  • rebuildGuildGroups() - skips inactive groups in registry

Example

When a Discord guild is deleted:

// Before: d.nk.GroupDelete(d.ctx, groupID)
// After: MarkGuildGroupInactive(d.ctx, d.nk, groupID, "Discord guild deleted")

Group name changes from "My Guild" to "[INACTIVE] My Guild" with metadata:

{
  "guild_id": "123456",
  "inactive": true,
  "inactive_reason": "Discord guild deleted"
}

All lookup functions automatically filter inactive groups - no application code changes needed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement guild group graveyard system and refactor deletion logic</issue_title>
<issue_description>### Overview
Implement a graveyard system for guild groups in Nakama:

  • If a guild group is no longer active, mark it as such:
    • Prefix the group name to reflect inactive status.
    • Add an inactive value in group metadata for tracking.

Tasks

  • Refactor all events in server/evr_*.go that currently delete a guild group, so they mark the group as inactive instead. Record a short reason for inactivation in metadata.
  • Update all locations where guild groups are looked up, ensuring any group in the graveyard is filtered/ignored by default.

Acceptance Criteria

  • No code path deletes groups outright--all use the new inactive-state system.
  • Consistent prefix and metadata structure for inactive groups.
  • Inactive guild groups do not appear in any lookup or selection.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 20, 2025 05:42
… of deleting

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement guild group graveyard system and refactor deletion logic Implement guild group graveyard system Nov 20, 2025
Copilot AI requested a review from thesprockee November 20, 2025 05:52
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.

Implement guild group graveyard system and refactor deletion logic

2 participants