Reputation: 1
I was wondering how can I send a embeds with message URL (this where it gonna send a message embeds)
I was been told to do this:
message.channel.messages.fetch(id_of_message)
And split the link into /
, and get each individual element you want and you can start fetching every element to get to the message
The mentions channel method is not working when I do this:
const channel = (message
? message.mentions.channels.first()
: interaction.options.getChannel('channel'))
if (!channel || channel.type !== 'GUILD_TEXT') {
return message.reply({content: 'please tag a channel'})
}
Upvotes: 0
Views: 325
Reputation: 957
I believe what you are asking is how to send a Message Embed through a Webhook.
A Webhook on Discord is just a URL you can interact with to send messages to a Discord channel.
You can create a webhook like this:
You will need to paste this URL in place of the placeholder URL. The following code should be placed at the top of your file!
const { WebhookClient, MessageEmbed } = require("discord.js");
const Hook = new WebhookClient({ url: 'https://discord.com/api/webhooks/XXXXXXXXX/XXXXXXXX' });
If you would like to actually send a Message Embed to that hook you can do so like this:
Hook.send({
embeds: [
new MessageEmbed()
.setTitle('Test Embed!')
.setDescription('This is a test!')
]
});
Upvotes: 1