2021-09-06 12:38:25 +02:00
|
|
|
const { MessageEmbed } = require("discord.js");
|
|
|
|
module.exports = {
|
|
|
|
name: "messageinfo",
|
|
|
|
category: "Information",
|
|
|
|
type: "CHAT_INPUT",
|
|
|
|
description: "Check the info of a message",
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
type: 3,
|
|
|
|
name: "message",
|
|
|
|
description: "The message you want to see",
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
run: async (client, interaction, args) => {
|
|
|
|
try {
|
2021-11-18 18:56:42 +01:00
|
|
|
await interaction.channel.messages.fetch(args[0]).catch(() => {
|
|
|
|
interaction.followUp({
|
2021-09-06 12:38:25 +02:00
|
|
|
content: "Message not found in this channel..",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const msg = await interaction.channel.messages.cache.get(args[0]);
|
|
|
|
const hasImage = msg.attachments.size && msg.attachments.first().width;
|
|
|
|
const embed = new MessageEmbed()
|
|
|
|
.setColor(msg.member ? msg.member.displayHexColor : client.color)
|
|
|
|
.setImage(hasImage ? msg.attachments.first().url : null)
|
|
|
|
.setAuthor(
|
|
|
|
msg.author.tag,
|
|
|
|
msg.author.displayAvatarURL({ format: "png", dynamic: true })
|
|
|
|
)
|
|
|
|
.addField("Content", msg.content || "No content")
|
|
|
|
.setTimestamp(msg.createdAt)
|
|
|
|
.addField("ID", msg.id)
|
2021-11-18 18:56:42 +01:00
|
|
|
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
2021-09-06 12:38:25 +02:00
|
|
|
.addField("Jump", `[Click Here to Jump](${msg.url})`);
|
2021-11-18 18:56:42 +01:00
|
|
|
return interaction.followUp({ embeds: [embed] });
|
2021-09-06 12:38:25 +02:00
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|