1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 16:30:59 -04:00

Cancel punishment if user is already banned

This commit is contained in:
TÆMBØ 2022-12-02 10:25:44 -08:00 committed by GitHub
parent cb018fad8c
commit 46c2ec5446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,7 +290,12 @@ class punishments extends Database {
}
if (['ban', 'softban'].includes(type)) {
const banned = await guild.bans.fetch(User.id).catch(() => undefined);
if (!banned) {
punResult = await guild.bans.create(User.id, {reason: `${reason} | Case #${punData.id}`}).catch((err: Error) => err.message);
} else {
punResult = 'User is already banned.';
}
} else if (type == 'kick') {
punResult = await GuildMember?.kick(`${reason} | Case #${punData.id}`).catch((err: Error) => err.message);
} else if (type == 'mute') {