mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 10:34:16 +02:00
fix(arabot): check if user is banned
This commit is contained in:
parent
556038ee80
commit
9d3f687473
@ -20,7 +20,7 @@
|
|||||||
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
|
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
|
||||||
import type { User, Message, TextChannel } from 'discord.js';
|
import type { User, Message, TextChannel } from 'discord.js';
|
||||||
import IDs from '../../utils/ids';
|
import IDs from '../../utils/ids';
|
||||||
import { removeBan } from '../../utils/database/ban';
|
import { removeBan, checkActive } from '../../utils/database/ban';
|
||||||
|
|
||||||
class UnbanCommand extends Command {
|
class UnbanCommand extends Command {
|
||||||
public constructor(context: Command.Context, options: Command.Options) {
|
public constructor(context: Command.Context, options: Command.Options) {
|
||||||
@ -64,27 +64,26 @@ class UnbanCommand extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unban the user
|
if (!await checkActive(user.id)) {
|
||||||
try {
|
|
||||||
await guild.members.unban(user);
|
|
||||||
} catch {
|
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${user} is not banned.`,
|
content: `${user} is not banned.`,
|
||||||
ephemeral: true,
|
|
||||||
fetchReply: true,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unban the user
|
||||||
|
await guild.members.unban(user)
|
||||||
|
.catch(() => {});
|
||||||
|
|
||||||
|
// Add unban to database
|
||||||
|
await removeBan(user.id, mod.user.id);
|
||||||
|
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${user} has been unbanned.`,
|
content: `${user} has been unbanned.`,
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
fetchReply: true,
|
fetchReply: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add unban to database
|
|
||||||
await removeBan(user.id, mod.user.id);
|
|
||||||
|
|
||||||
// Log the ban
|
// Log the ban
|
||||||
let modRestrict = guild.channels.cache.get(IDs.channels.restricted.moderators) as TextChannel | undefined;
|
let modRestrict = guild.channels.cache.get(IDs.channels.restricted.moderators) as TextChannel | undefined;
|
||||||
|
|
||||||
@ -127,10 +126,7 @@ class UnbanCommand extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unban the user
|
if (!await checkActive(user.id)) {
|
||||||
try {
|
|
||||||
await guild.members.unban(user);
|
|
||||||
} catch {
|
|
||||||
await message.react('❌');
|
await message.react('❌');
|
||||||
await message.reply({
|
await message.reply({
|
||||||
content: `${user} is not banned.`,
|
content: `${user} is not banned.`,
|
||||||
@ -138,11 +134,15 @@ class UnbanCommand extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await message.react('✅');
|
// Unban the user
|
||||||
|
await guild.members.unban(user)
|
||||||
|
.catch(() => {});
|
||||||
|
|
||||||
// Add unban to database
|
// Add unban to database
|
||||||
await removeBan(user.id, mod.id);
|
await removeBan(user.id, mod.id);
|
||||||
|
|
||||||
|
await message.react('✅');
|
||||||
|
|
||||||
await message.reply({
|
await message.reply({
|
||||||
content: `${user} has been unbanned.`,
|
content: `${user} has been unbanned.`,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user