Skip to content

Feat/whitelist create command#78

Open
TheBjoRedCraft wants to merge 4 commits intoversion/6.0.0from
feat/whitelist-create-command
Open

Feat/whitelist create command#78
TheBjoRedCraft wants to merge 4 commits intoversion/6.0.0from
feat/whitelist-create-command

Conversation

@TheBjoRedCraft
Copy link
Copy Markdown
Member

No description provided.

@TheBjoRedCraft TheBjoRedCraft self-assigned this Mar 24, 2026
Copilot AI review requested due to automatic review settings March 24, 2026 15:23
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

Adds a staff-facing slash command to create survival whitelist entries, including new permission wiring and localized feedback messages.

Changes:

  • Introduces /wl-create to create a whitelist entry from a Discord user + Minecraft name.
  • Adds WHITELIST_CREATE permission and assigns it to relevant guild roles.
  • Adds new i18n messages for “already whitelisted” and “create success”, and bumps project version.

Reviewed changes

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

Show a summary per file
File Description
src/main/resources/messages.properties Adds new whitelist-related command messages (duplicate checks + success).
src/main/kotlin/dev/slne/surf/discord/ticket/command/whitelist/CreateWhitelistCommand.kt New slash command implementation for creating whitelist entries.
src/main/kotlin/dev/slne/surf/discord/permission/permission-util.kt Grants WHITELIST_CREATE to moderation/management/developer roles and keeps role map updated.
src/main/kotlin/dev/slne/surf/discord/permission/DiscordPermission.kt Adds the new WHITELIST_CREATE enum value.
gradle.properties Version bump to 6.0.19-SNAPSHOT.

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

Comment on lines +57 to +63
val whitelist = socialService.whitelist(userId, minecraftName)

event.reply(
translatable(
"whitelist.command.create.success",
"<@${whitelist?.discordId}>",
whitelist?.getMinecraftName() ?: whitelist?.minecraftUuid.toString()
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

socialService.whitelist(userId, minecraftName) can return null (e.g., when PlayerLookupService.getUuid(minecraftName) can’t resolve the username). In that case this code will still send the success reply with <@null> and "null" as the Minecraft value. Handle the null case explicitly by replying with an error (you already have whitelist.survival.modal.user-not-found), and only format the success message with non-null values.

Suggested change
val whitelist = socialService.whitelist(userId, minecraftName)
event.reply(
translatable(
"whitelist.command.create.success",
"<@${whitelist?.discordId}>",
whitelist?.getMinecraftName() ?: whitelist?.minecraftUuid.toString()
val whitelist = socialService.whitelist(userId, minecraftName) ?: run {
event.reply(translatable("whitelist.survival.modal.user-not-found"))
.setEphemeral(true)
.queue()
return
}
event.reply(
translatable(
"whitelist.command.create.success",
"<@${whitelist.discordId}>",
whitelist.getMinecraftName() ?: whitelist.minecraftUuid.toString()

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +68
val whitelist = socialService.whitelist(userId, minecraftName)

event.reply(
translatable(
"whitelist.command.create.success",
"<@${whitelist?.discordId}>",
whitelist?.getMinecraftName() ?: whitelist?.minecraftUuid.toString()
)
)
.setEphemeral(true)
.queue()
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

After successfully creating a whitelist entry, this command doesn’t grant the configured whitelist role to the target Discord user. In the existing flow (SurvivalWhitelistCreateModal) the role is added immediately, so staff-created whitelist entries may not take effect for members already in the guild until they rejoin / an unblock occurs. Consider adding the botConfig.whitelistedRoleId role to guild.getMemberById(userId) on success (and handle the case where the user isn’t in the guild).

Copilot uses AI. Check for mistakes.
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