1 |
import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { BanOptions, CommandInteraction, 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'; |
10 |
import ms from 'ms'; |
import ms from 'ms'; |
11 |
import { unmute } from './UnmuteCommand'; |
import { unmute } from './UnmuteCommand'; |
12 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
13 |
import { shouldNotModerate } from '../../utils/util'; |
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
14 |
|
|
15 |
export async function mute(client: DiscordClient, dateTime: number | undefined, user: GuildMember, msg: Message | CommandInteraction, timeInterval: number | undefined, reason: string | undefined, hard: boolean = false) { |
export async function mute(client: DiscordClient, dateTime: number | undefined, user: GuildMember, msg: Message | CommandInteraction, timeInterval: number | undefined, reason: string | undefined, hard: boolean = false) { |
16 |
try { |
try { |
119 |
|
|
120 |
export default class MuteCommand extends BaseCommand { |
export default class MuteCommand extends BaseCommand { |
121 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
122 |
|
permissions = [Permissions.FLAGS.MODERATE_MEMBERS]; |
123 |
|
|
124 |
constructor() { |
constructor() { |
125 |
super('mute', 'moderation', []); |
super('mute', 'moderation', []); |
241 |
dateTime = Date.now() + timeInterval; |
dateTime = Date.now() + timeInterval; |
242 |
} |
} |
243 |
|
|
244 |
|
if (!(await hasPermission(client, user, msg, null, "You don't have permission to mute this user."))) { |
245 |
|
return; |
246 |
|
} |
247 |
|
|
248 |
if (shouldNotModerate(client, user)) { |
if (shouldNotModerate(client, user)) { |
249 |
await msg.reply({ |
await msg.reply({ |
250 |
embeds: [ |
embeds: [ |