Skip to content

Commit 88527de

Browse files
committed
Fix a mistake with canModerate
1 parent 74d8e2d commit 88527de

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

backend/src/plugin/moderation/config.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ export const ModerationConfig = z.strictObject({
3434
preset_reasons: z.array(PresetReason).default([]), // TODO
3535
preset_prefix: z.string().default("!"), // TODO
3636

37+
member_ranking: mappedEnum({
38+
none: MemberRanking.None,
39+
highest_role: MemberRanking.HighestRole,
40+
level: MemberRanking.Level
41+
}).default(MemberRanking.HighestRole).describe(
42+
"Customize the system used to determine whether a moderator can moderate a user.\n" +
43+
"'none' allows anyone to be moderated by a moderator.\n" +
44+
"'highest_role' reflects the behavior of Discord; you can only moderate users who's highest role is below yours.\n" +
45+
"'level' is based on who has a higher level in the app's group system."
46+
),
47+
3748
ban: z.strictObject({
3849
send_direct_message: z.boolean().default(false),
3950
direct_message: messageTemplate(actionParams).optional(),
@@ -63,17 +74,6 @@ export const ModerationConfig = z.strictObject({
6374
preset_reasons: PresetReason.array().default(discordReasons),
6475
}).prefault({}).describe("Configure warn behavior"),
6576

66-
member_ranking: mappedEnum({
67-
none: MemberRanking.None,
68-
highest_role: MemberRanking.HighestRole,
69-
level: MemberRanking.Level
70-
}).default(MemberRanking.HighestRole).describe(
71-
"Customize the system used to determine whether a moderator can moderate a user.\n" +
72-
"'none' allows anyone to be moderated by a moderator.\n" +
73-
"'highest_role' reflects the behavior of Discord; you can only moderate users who's highest role is below yours.\n" +
74-
"'level' is based on who has a higher level in the app's group system."
75-
),
76-
7777
default_permissions: z.strictObject({
7878
ban: z.boolean().default(false),
7979
unban: z.boolean().default(false),

backend/src/plugin/moderation/discord/helper/bulkAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function doBulkAction(action: BulkAction): Promise<BulkResult> {
8181
continue;
8282
}
8383

84-
if (!canModerate(action.memberRanking, action.guild.clientMember, target)) {
84+
if (!canModerate(MemberRanking.HighestRole, action.guild.clientMember, target)) {
8585
result.unsuccessful.push({
8686
error: "App lacks permission to moderate the user",
8787
user: target,

0 commit comments

Comments
 (0)