Skip to content

Commit 164150c

Browse files
revert moderation_issue_handler
1 parent ba56a92 commit 164150c

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

src/components/moderation/moderation-common.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,34 @@ export abstract class ModerationComponent extends BotComponent {
652652
) {
653653
try {
654654
for (const user of users) {
655-
await this.moderation_issue_handler(command, user, duration_string, reason, basic_moderation_info);
655+
const target = await this.wheatley.try_fetch_guild_member(user);
656+
const issuer = unwrap(await this.wheatley.try_fetch_guild_member(command.user));
657+
if (target && target.roles.highest.position >= issuer.roles.highest.position) {
658+
await this.reply_with_error(command, unwrap(get_random_array_element(joke_responses_other)));
659+
return;
660+
}
661+
const base_moderation: basic_moderation_with_user = { ...basic_moderation_info, user: user.id };
662+
if (!this.is_once_off && (await this.is_moderation_applied(base_moderation))) {
663+
await this.reply_with_error(command, `${user.displayName} is already ${this.past_participle}`);
664+
continue;
665+
}
666+
const moderation: moderation_entry = {
667+
...basic_moderation_info,
668+
case_number: -1,
669+
user: user.id,
670+
user_name: user.displayName,
671+
moderator: command.user.id,
672+
moderator_name: (await command.get_member()).displayName,
673+
reason,
674+
issued_at: Date.now(),
675+
duration: parse_nullable_duration(duration_string),
676+
active: !this.is_once_off,
677+
removed: null,
678+
expunged: null,
679+
link: command.get_or_forge_url(),
680+
};
681+
await this.notify_user(user, this.past_participle, moderation);
682+
await this.issue_moderation(moderation);
656683
}
657684
await command.replyOrFollowUp({
658685
embeds: [

0 commit comments

Comments
 (0)