mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 10:34:16 +02:00
feat(arabot): add check if user is already banned
This commit is contained in:
parent
534b45f5db
commit
1c5ec53b3b
@ -20,7 +20,7 @@
|
||||
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import type { User, Message, TextChannel } from 'discord.js';
|
||||
import IDs from '../../utils/ids';
|
||||
import { addBan } from '../../utils/database/ban';
|
||||
import { addBan, checkActive } from '../../utils/database/ban';
|
||||
|
||||
class BanCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
@ -81,6 +81,11 @@ class BanCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await checkActive(user.id)) {
|
||||
await interaction.reply(`${user} is already banned!`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Checks if the user is not restricted
|
||||
if (guildMember.roles.cache.has(IDs.roles.vegan.vegan)
|
||||
|| guildMember.roles.cache.has(IDs.roles.nonvegan.nonvegan)) {
|
||||
@ -157,6 +162,12 @@ class BanCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await checkActive(user.id)) {
|
||||
await message.react('❌');
|
||||
await message.reply(`${user} is already banned!`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.channel.id !== IDs.channels.restricted.moderators) {
|
||||
await message.react('❌');
|
||||
await message.reply(`You can only run this command in <#${IDs.channels.restricted.moderators}> `
|
||||
|
Loading…
x
Reference in New Issue
Block a user