mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 12:21:00 -05:00
Cancel punishment if user is already banned
This commit is contained in:
parent
f07e8cc0e4
commit
920828c3e6
@ -290,7 +290,12 @@ class punishments extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (['ban', 'softban'].includes(type)) {
|
if (['ban', 'softban'].includes(type)) {
|
||||||
punResult = await guild.bans.create(User.id, {reason: `${reason} | Case #${punData.id}`}).catch((err: Error) => err.message);
|
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') {
|
} else if (type == 'kick') {
|
||||||
punResult = await GuildMember?.kick(`${reason} | Case #${punData.id}`).catch((err: Error) => err.message);
|
punResult = await GuildMember?.kick(`${reason} | Case #${punData.id}`).catch((err: Error) => err.message);
|
||||||
} else if (type == 'mute') {
|
} else if (type == 'mute') {
|
||||||
|
Loading…
Reference in New Issue
Block a user