mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
default ban message (no reason specified)
This commit is contained in:
parent
3217f35017
commit
bf9d27dad0
1 changed files with 6 additions and 4 deletions
|
@ -42,10 +42,12 @@ export async function banUserId(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reason = reason || "No reason specified";
|
||||||
|
|
||||||
// Attempt to message the user *before* banning them, as doing it after may not be possible
|
// Attempt to message the user *before* banning them, as doing it after may not be possible
|
||||||
const member = await resolveMember(pluginData.client, pluginData.guild, userId);
|
const member = await resolveMember(pluginData.client, pluginData.guild, userId);
|
||||||
let notifyResult: UserNotificationResult = { method: null, success: true };
|
let notifyResult: UserNotificationResult = { method: null, success: true };
|
||||||
if (reason && member) {
|
if (member) {
|
||||||
const contactMethods = banOptions?.contactMethods
|
const contactMethods = banOptions?.contactMethods
|
||||||
? banOptions.contactMethods
|
? banOptions.contactMethods
|
||||||
: getDefaultContactMethods(pluginData, "ban");
|
: getDefaultContactMethods(pluginData, "ban");
|
||||||
|
@ -91,7 +93,7 @@ export async function banUserId(
|
||||||
const deleteMessageDays = Math.min(7, 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, {
|
||||||
deleteMessageSeconds: (deleteMessageDays * DAYS) / SECONDS,
|
deleteMessageSeconds: (deleteMessageDays * DAYS) / SECONDS,
|
||||||
reason: reason ?? undefined,
|
reason,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let errorMessage;
|
let errorMessage;
|
||||||
|
@ -149,7 +151,7 @@ export async function banUserId(
|
||||||
mod,
|
mod,
|
||||||
user,
|
user,
|
||||||
caseNumber: createdCase.case_number,
|
caseNumber: createdCase.case_number,
|
||||||
reason: reason ?? "",
|
reason,
|
||||||
banTime: humanizeDuration(banTime),
|
banTime: humanizeDuration(banTime),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +159,7 @@ export async function banUserId(
|
||||||
mod,
|
mod,
|
||||||
user,
|
user,
|
||||||
caseNumber: createdCase.case_number,
|
caseNumber: createdCase.case_number,
|
||||||
reason: reason ?? "",
|
reason,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue