mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 09:35:02 +00:00
Trim down reason to <512 characters as to not receive api errors
This commit is contained in:
parent
f733f081e0
commit
a4e7b5624f
1 changed files with 4 additions and 0 deletions
|
@ -85,6 +85,10 @@ export async function banUserId(
|
|||
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
||||
try {
|
||||
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
||||
// Trim down reason to 490 words, API limit is 512 and we leave a gap to accomodate cross-ban bots
|
||||
if (reason && reason.length >= 490) {
|
||||
reason = reason.substring(0, 200) + "...";
|
||||
}
|
||||
await pluginData.guild.bans.create(userId as Snowflake, {
|
||||
days: deleteMessageDays,
|
||||
reason: reason ?? undefined,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue