1 |
import { BanOptions, CommandInteraction, Guild, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { CommandInteraction, Message, User, Permissions } 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'; |
7 |
import getUser from '../../utils/getUser'; |
import getUser from '../../utils/getUser'; |
8 |
import History from '../../automod/History'; |
import Punishment from '../../models/Punishment'; |
9 |
import getMember from '../../utils/getMember'; |
import PunishmentType from '../../types/PunishmentType'; |
|
import ms from 'ms'; |
|
10 |
|
|
11 |
export default class UnbanCommand extends BaseCommand { |
export default class UnbanCommand extends BaseCommand { |
12 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
13 |
|
permissions = [Permissions.FLAGS.BAN_MEMBERS]; |
14 |
|
|
15 |
constructor() { |
constructor() { |
16 |
super('unban', 'moderation', []); |
super('unban', 'moderation', []); |
73 |
|
|
74 |
try { |
try { |
75 |
await msg.guild?.bans.remove(user); |
await msg.guild?.bans.remove(user); |
76 |
await History.create(user.id, msg.guild!, 'unban', (msg.member!.user as User).id, null); |
|
77 |
|
await Punishment.create({ |
78 |
|
type: PunishmentType.UNBAN, |
79 |
|
user_id: user.id, |
80 |
|
guild_id: msg.guild!.id, |
81 |
|
mod_id: msg.member!.user.id, |
82 |
|
mod_tag: (msg.member!.user as User).tag, |
83 |
|
createdAt: new Date() |
84 |
|
}); |
85 |
} |
} |
86 |
catch (e) { |
catch (e) { |
87 |
console.log(e); |
console.log(e); |