mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Merge pull request #323 from almeidx/ban-thing
fix: allow 0 deleteMessageDays and fix upper limit
This commit is contained in:
commit
9fc33181eb
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ export const BanAction = automodAction({
|
||||||
const reason = actionConfig.reason || "Kicked automatically";
|
const reason = actionConfig.reason || "Kicked automatically";
|
||||||
const duration = actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : undefined;
|
const duration = actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : undefined;
|
||||||
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
|
const contactMethods = actionConfig.notify ? resolveActionContactMethods(pluginData, actionConfig) : undefined;
|
||||||
const deleteMessageDays = actionConfig.deleteMessageDays || undefined;
|
const deleteMessageDays = actionConfig.deleteMessageDays ?? undefined;
|
||||||
|
|
||||||
const caseArgs: Partial<CaseArgs> = {
|
const caseArgs: Partial<CaseArgs> = {
|
||||||
modId: pluginData.client.user!.id,
|
modId: pluginData.client.user!.id,
|
||||||
|
|
|
@ -85,7 +85,7 @@ export async function banUserId(
|
||||||
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId);
|
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId);
|
||||||
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
||||||
try {
|
try {
|
||||||
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
const deleteMessageDays = Math.min(7, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
||||||
await pluginData.guild.bans.create(userId as Snowflake, {
|
await pluginData.guild.bans.create(userId as Snowflake, {
|
||||||
days: deleteMessageDays,
|
days: deleteMessageDays,
|
||||||
reason: reason ?? undefined,
|
reason: reason ?? undefined,
|
||||||
|
|
Loading…
Add table
Reference in a new issue