mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 07:35:02 +00:00
Add a warning when the user has >= specified amount of warns
This commit is contained in:
parent
2f89d3ae25
commit
930dabf5cd
2 changed files with 25 additions and 0 deletions
|
@ -51,6 +51,7 @@ interface IModActionsPluginConfig {
|
|||
ban_message: string;
|
||||
alert_on_rejoin: boolean;
|
||||
alert_channel: string;
|
||||
warn_amount_notify_threshhold: number;
|
||||
|
||||
can_note: boolean;
|
||||
can_warn: boolean;
|
||||
|
@ -97,6 +98,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
|
|||
ban_message: "You have been banned from {guildName}. Reason given: {reason}",
|
||||
alert_on_rejoin: false,
|
||||
alert_channel: null,
|
||||
warn_amount_notify_threshhold: 5,
|
||||
|
||||
can_note: false,
|
||||
can_warn: false,
|
||||
|
@ -444,6 +446,14 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
|
|||
),
|
||||
);
|
||||
|
||||
const priorWarnAmount = (await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn)) - 1;
|
||||
if (priorWarnAmount >= config.warn_amount_notify_threshhold) {
|
||||
this.sendErrorMessage(
|
||||
msg.channel,
|
||||
`The user already has ${(await priorWarnAmount) - 1} prior warnings ${msg.author.mention}!`,
|
||||
);
|
||||
}
|
||||
|
||||
this.serverLogs.log(LogType.MEMBER_WARN, {
|
||||
mod: stripObjectToScalars(mod.user),
|
||||
member: stripObjectToScalars(memberToWarn, ["user", "roles"]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue