Refactor/manage overflow - #356
Draft
kendrome wants to merge 11 commits into
Draft
Conversation
kendrome
commented
Jul 13, 2026
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
…lls information directly from DiscordSocketClient for authentication - Cleanup of ManageOverflow
… be triggered on the website by an admin
There was a problem hiding this comment.
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
DiscordRestApiClienthelper 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.
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>
- Remove unused code
…e/EGG9000 into refactor/manage-overflow
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 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}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.