1 |
import { BanOptions, CommandInteraction, Emoji, GuildChannel, GuildMember, Interaction, Message, TextChannel, User } from 'discord.js'; |
import { CommandInteraction, Emoji, GuildChannel, Message, TextChannel, 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'; |
|
import getMember from '../../utils/getMember'; |
|
|
import History from '../../automod/History'; |
|
8 |
import { fetchEmoji } from '../../utils/Emoji'; |
import { fetchEmoji } from '../../utils/Emoji'; |
9 |
import { shouldNotModerate } from '../../utils/util'; |
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
10 |
|
|
11 |
export default class ClearCommand extends BaseCommand { |
export default class ClearCommand extends BaseCommand { |
12 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
13 |
|
permissions = [Permissions.FLAGS.MANAGE_MESSAGES]; |
14 |
|
|
15 |
constructor() { |
constructor() { |
16 |
super('clear', 'moderation', []); |
super('clear', 'moderation', []); |
93 |
try { |
try { |
94 |
const member = await msg.guild?.members.fetch(user.id); |
const member = await msg.guild?.members.fetch(user.id); |
95 |
|
|
96 |
|
if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to clear messages from this user."))) |
97 |
|
return; |
98 |
|
|
99 |
if (member && shouldNotModerate(client, member)) { |
if (member && shouldNotModerate(client, member)) { |
100 |
await msg.reply({ |
await msg.reply({ |
101 |
embeds: [ |
embeds: [ |
108 |
} |
} |
109 |
catch (e) { |
catch (e) { |
110 |
console.log(e); |
console.log(e); |
|
return; |
|
111 |
} |
} |
112 |
} |
} |
113 |
|
|