mod_actions: add warn_notify_enabled option, false by default
This commit is contained in:
parent
48c9721945
commit
213db4d168
1 changed files with 3 additions and 1 deletions
|
@ -46,6 +46,7 @@ const ConfigSchema = t.type({
|
||||||
ban_message: tNullable(t.string),
|
ban_message: tNullable(t.string),
|
||||||
alert_on_rejoin: t.boolean,
|
alert_on_rejoin: t.boolean,
|
||||||
alert_channel: tNullable(t.string),
|
alert_channel: tNullable(t.string),
|
||||||
|
warn_notify_enabled: t.boolean,
|
||||||
warn_notify_threshold: t.number,
|
warn_notify_threshold: t.number,
|
||||||
warn_notify_message: t.string,
|
warn_notify_message: t.string,
|
||||||
ban_delete_message_days: t.number,
|
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}",
|
ban_message: "You have been banned from the {guildName} server. Reason given: {reason}",
|
||||||
alert_on_rejoin: false,
|
alert_on_rejoin: false,
|
||||||
alert_channel: null,
|
alert_channel: null,
|
||||||
|
warn_notify_enabled: false,
|
||||||
warn_notify_threshold: 5,
|
warn_notify_threshold: 5,
|
||||||
warn_notify_message:
|
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?",
|
"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 casesPlugin = this.getPlugin<CasesPlugin>("cases");
|
||||||
const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn);
|
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(
|
const tooManyWarningsMsg = await msg.channel.createMessage(
|
||||||
config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`),
|
config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue