Conversation
There was a problem hiding this comment.
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-createto create a whitelist entry from a Discord user + Minecraft name. - Adds
WHITELIST_CREATEpermission 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.
| val whitelist = socialService.whitelist(userId, minecraftName) | ||
|
|
||
| event.reply( | ||
| translatable( | ||
| "whitelist.command.create.success", | ||
| "<@${whitelist?.discordId}>", | ||
| whitelist?.getMinecraftName() ?: whitelist?.minecraftUuid.toString() |
There was a problem hiding this comment.
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.
| 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() |
| val whitelist = socialService.whitelist(userId, minecraftName) | ||
|
|
||
| event.reply( | ||
| translatable( | ||
| "whitelist.command.create.success", | ||
| "<@${whitelist?.discordId}>", | ||
| whitelist?.getMinecraftName() ?: whitelist?.minecraftUuid.toString() | ||
| ) | ||
| ) | ||
| .setEphemeral(true) | ||
| .queue() | ||
| } |
There was a problem hiding this comment.
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).
No description provided.