1 |
import { BanOptions, CommandInteraction, ContextMenuInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { BanOptions, CommandInteraction, ContextMenuInteraction, GuildMember, Interaction, Message, Permissions, 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'; |
9 |
import History from '../../automod/History'; |
import History from '../../automod/History'; |
10 |
import Punishment from '../../models/Punishment'; |
import Punishment from '../../models/Punishment'; |
11 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
12 |
import { shouldNotModerate } from '../../utils/util'; |
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
13 |
|
|
14 |
export default class KickCommand extends BaseCommand { |
export default class KickCommand extends BaseCommand { |
15 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
16 |
supportsContextMenu: boolean = true; |
supportsContextMenu: boolean = true; |
17 |
|
|
18 |
|
permissions = [Permissions.FLAGS.KICK_MEMBERS]; |
19 |
|
|
20 |
constructor() { |
constructor() { |
21 |
super('kick', 'moderation', ['Kick']); |
super('kick', 'moderation', ['Kick']); |
88 |
} |
} |
89 |
|
|
90 |
try { |
try { |
91 |
|
if (!(await hasPermission(client, user, msg, null, "You don't have permission to kick this user."))) { |
92 |
|
return; |
93 |
|
} |
94 |
|
|
95 |
if (!user.kickable || shouldNotModerate(client, user)) |
if (!user.kickable || shouldNotModerate(client, user)) |
96 |
throw new Error('User not kickable'); |
throw new Error('User not kickable'); |
97 |
|
|