1 |
import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { Permissions, BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
2 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
4 |
import CommandOptions from '../../types/CommandOptions'; |
import CommandOptions from '../../types/CommandOptions'; |
8 |
import History from '../../automod/History'; |
import History from '../../automod/History'; |
9 |
import Punishment from '../../models/Punishment'; |
import Punishment from '../../models/Punishment'; |
10 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
11 |
import { shouldNotModerate } from '../../utils/util'; |
import { shouldNotModerate, hasPermission } from '../../utils/util'; |
12 |
|
|
13 |
export default class BanCommand extends BaseCommand { |
export default class BanCommand extends BaseCommand { |
14 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
15 |
supportsContextMenu: boolean = true; |
supportsContextMenu: boolean = true; |
16 |
|
permissions = [Permissions.FLAGS.BAN_MEMBERS]; |
17 |
|
|
18 |
constructor() { |
constructor() { |
19 |
super('ban', 'moderation', ['Ban']); |
super('ban', 'moderation', ['Ban']); |
110 |
try { |
try { |
111 |
const member = await msg.guild?.members.fetch(user.id); |
const member = await msg.guild?.members.fetch(user.id); |
112 |
|
|
113 |
|
if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to ban this user."))) { |
114 |
|
return; |
115 |
|
} |
116 |
|
|
117 |
if (member && shouldNotModerate(client, member)) { |
if (member && shouldNotModerate(client, member)) { |
118 |
await msg.reply({ |
await msg.reply({ |
119 |
embeds: [ |
embeds: [ |