1 |
import { BanOptions, CommandInteraction, EmojiIdentifierResolvable, GuildMember, Interaction, Message, TextChannel, User } from 'discord.js'; |
import { BanOptions, CommandInteraction, EmojiIdentifierResolvable, FileOptions, GuildMember, Interaction, Message, Permissions, TextChannel, 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'; |
5 |
import InteractionOptions from '../../types/InteractionOptions'; |
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
import MessageEmbed from '../../client/MessageEmbed'; |
import MessageEmbed from '../../client/MessageEmbed'; |
|
import getUser from '../../utils/getUser'; |
|
|
import getMember from '../../utils/getMember'; |
|
|
import History from '../../automod/History'; |
|
7 |
import { fetchEmoji } from '../../utils/Emoji'; |
import { fetchEmoji } from '../../utils/Emoji'; |
8 |
|
import { parseEmbedsInString } from '../../utils/util'; |
9 |
|
|
10 |
export default class EchoCommand extends BaseCommand { |
export default class EchoCommand extends BaseCommand { |
11 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
55 |
return; |
return; |
56 |
} |
} |
57 |
|
|
58 |
try { |
try { |
59 |
|
let { embeds, content: parsedContent } = parseEmbedsInString(content); |
60 |
|
|
61 |
await channel.send({ |
await channel.send({ |
62 |
content |
content: parsedContent.trim() === '' ? undefined : parsedContent, |
63 |
|
embeds, |
64 |
|
files: msg instanceof CommandInteraction ? undefined : [...msg.attachments.map(a => ({ |
65 |
|
attachment: a.proxyURL, |
66 |
|
description: a.description, |
67 |
|
name: a.name |
68 |
|
} as FileOptions)).values()] |
69 |
}); |
}); |
70 |
|
|
71 |
if (options.isInteraction) { |
if (options.isInteraction) { |
89 |
embeds: [ |
embeds: [ |
90 |
new MessageEmbed() |
new MessageEmbed() |
91 |
.setColor('#f14a60') |
.setColor('#f14a60') |
92 |
.setDescription(`Failed to send message. Maybe missing permissions?`) |
.setDescription(`Failed to send message. Maybe missing permissions or invalid embed schema?`) |
93 |
], |
], |
94 |
ephemeral: true |
ephemeral: true |
95 |
}); |
}); |