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'; |
5 |
import InteractionOptions from '../../types/InteractionOptions'; |
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
import MessageEmbed from '../../client/MessageEmbed'; |
import MessageEmbed from '../../client/MessageEmbed'; |
|
import getUser from '../../utils/getUser'; |
|
7 |
import getMember from '../../utils/getMember'; |
import getMember from '../../utils/getMember'; |
|
import History from '../../automod/History'; |
|
8 |
import Punishment from '../../models/Punishment'; |
import Punishment from '../../models/Punishment'; |
9 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
10 |
import { shouldNotModerate } from '../../utils/util'; |
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
11 |
|
|
12 |
export default class KickCommand extends BaseCommand { |
export default class KickCommand extends BaseCommand { |
13 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
14 |
supportsContextMenu: boolean = true; |
supportsContextMenu: boolean = true; |
15 |
|
|
16 |
|
permissions = [Permissions.FLAGS.KICK_MEMBERS]; |
17 |
|
|
18 |
constructor() { |
constructor() { |
19 |
super('kick', 'moderation', ['Kick']); |
super('kick', 'moderation', ['Kick']); |
86 |
} |
} |
87 |
|
|
88 |
try { |
try { |
89 |
|
if (!(await hasPermission(client, user, msg, null, "You don't have permission to kick this user."))) { |
90 |
|
return; |
91 |
|
} |
92 |
|
|
93 |
if (!user.kickable || shouldNotModerate(client, user)) |
if (!user.kickable || shouldNotModerate(client, user)) |
94 |
throw new Error('User not kickable'); |
throw new Error('User not kickable'); |
95 |
|
|
101 |
guild_id: msg.guild!.id, |
guild_id: msg.guild!.id, |
102 |
mod_id: msg.member!.user.id, |
mod_id: msg.member!.user.id, |
103 |
mod_tag: (msg.member!.user as User).tag, |
mod_tag: (msg.member!.user as User).tag, |
104 |
reason |
reason, |
105 |
|
createdAt: new Date() |
106 |
}); |
}); |
107 |
|
|
108 |
// await History.create(user.id, msg.guild!, 'kick', msg.member!.user.id, typeof reason === 'undefined' ? null : reason); |
// await History.create(user.id, msg.guild!, 'kick', msg.member!.user.id, typeof reason === 'undefined' ? null : reason); |