Skip to content

Open up admin-lb run#2662

Merged
mkmccarty merged 1 commit into
mainfrom
mm-branch-9
May 17, 2026
Merged

Open up admin-lb run#2662
mkmccarty merged 1 commit into
mainfrom
mm-branch-9

Conversation

@mkmccarty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 17, 2026 00:51
@mkmccarty mkmccarty merged commit 8f2fc00 into main May 17, 2026
10 of 12 checks passed
@mkmccarty mkmccarty deleted the mm-branch-9 branch May 17, 2026 00:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 broadens /admin-lb run from a home-guild-only operation to a guild-scoped run, limiting collection/posting to the invoking guild when triggered manually.

Changes:

  • Adds guild-specific leaderboard config loading.
  • Adds a guildID parameter to collection/posting flows.
  • Updates /admin-lb run to invoke collection for the current guild and changes admin permission checks.

Reviewed changes

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

File Description
src/leaderboard/leaderboard.go Adds GetGuildLBConfigs and minor exported comments.
src/leaderboard/leaderboard_task.go Adds guild-scoped opt-in filtering and passes guild scope to posting.
src/leaderboard/leaderboard_slashcmd.go Removes home-guild restriction for run and invokes guild-scoped collection.
src/leaderboard/leaderboard_post.go Allows posting either all configured guilds or one specified guild.

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

Comment on lines +155 to +156
if err != nil || perms&discordgo.PermissionAdministrator == 0 {
respondEphemeral(s, i, "You need the Administrator permission to use admin commands.")

go func() {
RunLeaderboardCollection(s, dryRun, onProgress)
RunLeaderboardCollection(s, dryRun, i.GuildID, onProgress)
Comment on lines +144 to +146
if guildID != "" && o.GuildID != guildID {
continue
}
Comment on lines +106 to +114
if err == nil {
seen := make(map[string]bool)
for _, o := range optins {
if !seen[o.UserID] {
seen[o.UserID] = true
userIDs = append(userIDs, o.UserID)
}
}
}
@@ -76,7 +76,7 @@ var (
// RunLeaderboardCollection is the main weekly entry point. It fans out API
// calls through a bounded worker pool, saves results, then posts to Discord.
// Pass dryRun=true to skip the Discord post step.
Comment on lines +521 to +531
cfgs := make([]LBConfig, 0, len(rows))
for _, row := range rows {
cfg := LBConfig{
LBType: row.LbType,
GuildID: row.GuildID,
ChannelID: row.ChannelID,
}
if row.MessageIds.Valid && row.MessageIds.String != "" {
_ = json.Unmarshal([]byte(row.MessageIds.String), &cfg.MessageIDs)
}
cfgs = append(cfgs, cfg)

go func() {
RunLeaderboardCollection(s, dryRun, onProgress)
RunLeaderboardCollection(s, dryRun, i.GuildID, onProgress)
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