1 |
import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { BanOptions, CommandInteraction, 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'; |
9 |
import Punishment from '../../models/Punishment'; |
import Punishment from '../../models/Punishment'; |
10 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
11 |
import { fetchEmojiStr } from '../../utils/Emoji'; |
import { fetchEmojiStr } from '../../utils/Emoji'; |
12 |
import { shouldNotModerate } from '../../utils/util'; |
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
13 |
|
|
14 |
export default class SoftBanCommand extends BaseCommand { |
export default class SoftBanCommand extends BaseCommand { |
15 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
16 |
|
permissions = [Permissions.FLAGS.BAN_MEMBERS]; |
17 |
|
|
18 |
constructor() { |
constructor() { |
19 |
super('softban', 'moderation', []); |
super('softban', 'moderation', []); |
129 |
try { |
try { |
130 |
const member = await msg.guild!.members.fetch(user.id); |
const member = await msg.guild!.members.fetch(user.id); |
131 |
|
|
132 |
|
if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to softban this user."))) { |
133 |
|
return; |
134 |
|
} |
135 |
|
|
136 |
if (member && shouldNotModerate(client, member)) { |
if (member && shouldNotModerate(client, member)) { |
137 |
await msg.reply({ |
await msg.reply({ |
138 |
embeds: [ |
embeds: [ |