Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerge01 committed Nov 3, 2024
1 parent b7ca1b2 commit 0ccfcbe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/commands/moderation/Ban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export default class Ban {
)
return;

if ((await guild.bans.fetch()).get(user.id))
return await errorEmbed(
interaction,
`You can't ban ${user.displayName}.`,
"This user is already banned."
);

let expiresAt: number | undefined;
if (duration) {
const durationMs = ms(duration);
Expand Down
8 changes: 8 additions & 0 deletions src/commands/moderation/Kick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
SlashCommandSubcommandBuilder,
type ChatInputCommandInteraction
} from "discord.js";
import { errorEmbed } from "../../utils/embeds/errorEmbed";
import { errorCheck, modEmbed } from "../../utils/embeds/modEmbed";

export default class Kick {
Expand Down Expand Up @@ -31,6 +32,13 @@ export default class Kick {
)
return;

if (!interaction.guild?.members.cache.get(user.id))
return await errorEmbed(
interaction,
`You can't kick ${user.displayName}.`,
"This user is not in the server."
);

const reason = interaction.options.getString("reason");
await interaction.guild?.members.cache
.get(user.id)
Expand Down
4 changes: 1 addition & 3 deletions src/commands/moderation/Unban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export default class Unban {
const id = interaction.options.getString("id")!;
const reason = interaction.options.getString("reason")!;
const guild = interaction.guild!;
const target = (await guild.bans.fetch())
.map(ban => ban.user)
.filter(user => user.id == id)[0]!;
const target = (await guild.bans.fetch()).get(id)?.user!;

if (
await errorCheck(
Expand Down

0 comments on commit 0ccfcbe

Please sign in to comment.