mod_actions: add warn_notify_enabled option, false by default

This commit is contained in:
Dragory 2020-05-28 04:40:35 +03:00
parent 48c9721945
commit 213db4d168
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -46,6 +46,7 @@ const ConfigSchema = t.type({
ban_message: tNullable(t.string),
alert_on_rejoin: t.boolean,
alert_channel: tNullable(t.string),
warn_notify_enabled: t.boolean,
warn_notify_threshold: t.number,
warn_notify_message: t.string,
ban_delete_message_days: t.number,
@ -166,6 +167,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
ban_message: "You have been banned from the {guildName} server. Reason given: {reason}",
alert_on_rejoin: false,
alert_channel: null,
warn_notify_enabled: false,
warn_notify_threshold: 5,
warn_notify_message:
"The user already has **{priorWarnings}** warnings!\n Please check their prior cases and assess whether or not to warn anyways.\n Proceed with the warning?",
@ -690,7 +692,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
const casesPlugin = this.getPlugin<CasesPlugin>("cases");
const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn);
if (priorWarnAmount >= config.warn_notify_threshold) {
if (config.warn_notify_enabled && priorWarnAmount >= config.warn_notify_threshold) {
const tooManyWarningsMsg = await msg.channel.createMessage(
config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`),
);