Repository navigation
fix(bot): log a banned member as User Left - #390
Conversation
A kick, a ban or a softban is told by its case in moderation.channel, which keeps the roles, so the leave log no longer repeats it with another footer and a roles line.
|
Architecture Data flow Review ✨ Nothing flagged · reviewed Tip Open a diagram on the canvas, then press W or click play to walk through the change one step at a time 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the single commit on this PR in full.
- Leave log always
User Left—rawMemberRemoveNotifyno longer looks up the latest case or the member's roles, so the footer and description are the same whatever made the member leave. - Dead locale keys removed —
guildMemberBanned,guildMemberKicked,guildMemberSoftBannedandguildMemberRemoveRolesare dropped fromen-US/events/guilds-members.jsonandi18next.d.ts; nothing else in the repo references them, andfetchMemberRoleIds,formatRoleMentionsandgetLatestRecentCachedEntryForUserstill have other callers. - Tests and docs —
memberLogs.test.tsnow checks the footer isUser Leftfor every case type and that a banned member's roles are not listed; theAGENTS.mdbullet matches the new behavior.
claude-sonnet-5-5 | 𝕏
| const description = t(key, { | ||
| user: getUserMentionWithFlagsString(user.flags ?? 0, user.id), | ||
| relativeTime: time(seconds.fromMilliseconds(joinedTimestamp), TimestampStyles.RelativeTime) | ||
| }); |
There was a problem hiding this comment.
Voluntary leaves lose role records
When a cached member leaves voluntarily, rawMemberRemoveNotify now drops their roles along with the roles of banned members. An ordinary leave creates no moderation case, so nothing replaces the removed record. Moderators can no longer use it to restore roles when the member returns. Keep the roles line for voluntary leaves, as the PR description promises.
Greptile automatically discovered a related ticket stating that leave logs should list the member’s roles, which informed this comment.
Source Used: Linear — request: show the roles a member had when they leave or are banned
Prompt To Fix With AI
This is a comment left during a code review.
Path: projects/bot/src/listeners/guilds/members/rawMemberRemoveNotify.ts
Line: 37-40
Comment:
**Voluntary leaves lose role records**
When a cached member leaves voluntarily, `rawMemberRemoveNotify` now drops their roles along with the roles of banned members. An ordinary leave creates no moderation case, so nothing replaces the removed record. Moderators can no longer use it to restore roles when the member returns. Keep the roles line for voluntary leaves, as the PR description promises.
Greptile automatically discovered a related ticket stating that leave logs should list the member’s roles, which informed this comment.
**Source Used:** Linear — [request: show the roles a member had when they leave or are banned](https://linear.app/wolfstar-project/issue/WOL-84/request-show-the-roles-a-member-had-when-they-leave-or-are-banned)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| .setAuthor(getFullEmbedAuthor(user)) | ||
| .setDescription(description) | ||
| .setFooter({ text: footer }) | ||
| .setFooter({ text: t('events/guilds-members:guildMemberRemove') }) |
There was a problem hiding this comment.
Kicks look like voluntary leaves
The unconditional guildMemberRemove footer changes kicks and softbans to User Left too. Readers can no longer distinguish those actions from voluntary departures. The PR description explicitly says they should keep User Kicked and User Softbanned.
Preserve those two branches and use User Left for bans and ordinary leaves. The updated test currently expects the same incorrect footer for all four cases.
Prompt To Fix With AI
This is a comment left during a code review.
Path: projects/bot/src/listeners/guilds/members/rawMemberRemoveNotify.ts
Line: 46
Comment:
**Kicks look like voluntary leaves**
The unconditional `guildMemberRemove` footer changes kicks and softbans to `User Left` too. Readers can no longer distinguish those actions from voluntary departures. The PR description explicitly says they should keep `User Kicked` and `User Softbanned`.
Preserve those two branches and use `User Left` for bans and ordinary leaves. The updated test currently expects the same incorrect footer for all four cases.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
🔗 Linked issue
None.
❓ Type of change
📚 Description
The leave log of a banned member said
User Bannedand listed the roles the member had. The case of the ban inmoderation.channelalready tells both, so the log read as a second, wrong report.A banned member is now logged as
User Left. The roles line stays for a member who left by themselves, and a ban, a kick or a softban no longer lists roles, since its case keeps them. A kick and a softban keep theirUser KickedandUser Softbannedfooters. TheguildMemberBannedtext stays in the locale file, unused for now.The PR should not merge until voluntary leaves retain their roles and kicks and softbans retain their promised labels.
Reviews (6) · Last reviewed commit: "fix(bot): log every member who leaves as..." · Reviewed by Greptile