Skip to content

Refactor/manage overflow - #356

Draft
kendrome wants to merge 11 commits into
masterfrom
refactor/manage-overflow
Draft

Refactor/manage overflow#356
kendrome wants to merge 11 commits into
masterfrom
refactor/manage-overflow

Conversation

@kendrome

Copy link
Copy Markdown
Collaborator
  • Adds in a new DiscordRestApiClient allowing us to make direct calls to the Discord Rest API
  • Refactors the Manage Overflow breaking things into smaller parts
  • Updates the command permission sync and adds a link to the admin page

kendrome added 2 commits July 13, 2026 13:50
…lls information directly from DiscordSocketClient for authentication

- Cleanup of ManageOverflow

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the overflow-management workflow by splitting responsibilities into smaller helpers, and introduces a new REST client to perform direct Discord API calls for syncing application command permissions via the admin UI.

Changes:

  • Added a DiscordRestApiClient helper for direct REST calls to Discord (command-permission sync).
  • Refactored overflow management into smaller methods and moved role/permission sync logic into OverflowSyncing.
  • Added an Admin UI entry point to trigger command permission syncing and updated the controller to use the new syncing signature.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
EGG9000.Site/Views/Admin/Index.cshtml Adds an Admin button to trigger overflow command permission sync.
EGG9000.Site/Controllers/AdminController.cs Updates the permission-sync action to call the refactored syncing helper.
EGG9000.Common/Helpers/Discord/OverflowSyncing.cs Refactors overflow syncing into role sync + command-permission sync, using the new REST client.
EGG9000.Common/Helpers/Discord/DiscordRestApiClient.cs New REST API client wrapper for Discord endpoints used by syncing.
EGG9000.Bot/Automated/ManageOverflow.cs Refactors ManageOverflow into smaller methods; currently leaves channel permission sync stubbed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread EGG9000.Common/Helpers/Discord/OverflowSyncing.cs Outdated
Comment thread EGG9000.Common/Helpers/Discord/OverflowSyncing.cs Outdated
Comment thread EGG9000.Common/Helpers/Discord/OverflowSyncing.cs Outdated
Comment thread EGG9000.Common/Helpers/Discord/DiscordRestApiClient.cs
Comment thread EGG9000.Bot/Automated/ManageOverflow.cs Outdated
Comment thread EGG9000.Bot/Automated/ManageOverflow.cs Outdated
Comment thread EGG9000.Site/Controllers/AdminController.cs
Comment thread EGG9000.Common/Helpers/Discord/OverflowSyncing.cs
kendrome and others added 7 commits July 13, 2026 18:07
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comment on lines +56 to +59
if (overflowRole is null) {
overflowRole = await overflowServer.CreateRoleAsync(role.Name, color: syncColors);
logger?.LogInformation("Created role {roleName} in {serverName}", role.Name, overflowServer.Name);
} else if (!role.Permissions.Equals(overflowRole.Permissions) || overflowRole.Color != role.Color) {
Comment on lines +123 to +124
if (guild is null || guild.OverflowServers.Count == 0 || guild.RolesToSync is null || !guild.RolesToSync.Contains(originalRole.Id.ToString()))
return;
Comment on lines +269 to +280
} //public class Permission {
// public string Id { get; set; }
// public int Type { get; set; }
// public bool PermissionBool { get; set; }
//}

//public class GuildApplicationCommandPermissions {
// public string Id { get; set; }
// public string ApplicationId { get; set; }
// public string GuildId { get; set; }
// public List<Permission> Permissions { get; set; }
//}
Comment thread EGG9000.Bot/Automated/ManageOverflow.cs
Comment on lines 1473 to 1477
}
}

[Authorize(Roles = "Admin,GuildAdmin")]
public async Task<IActionResult> SyncCommandPermissions(string access_token) {
Comment on lines +1448 to 1451
[Authorize(Roles = "Admin,GuildAdmin")]
public IActionResult Sync() {
var url = Url.ActionLink("DiscordReturn");
return Redirect($"https://discordapp.com/api/oauth2/authorize?response_type=code&client_id={_configuration.GetConnectionString("ClientId")}&scope=identify%20guilds.join%20applications.commands.permissions.update&state=15773059ghq9183habn&redirect_uri={url}");
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.

3 participants