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