Issue
I have a Discord bot that should send a welcome message in the next format:
Some text1
<img1>
Some text2
<img2>
Some text3
I am using the next code for it (but in this case all images will be in the end of the message):
const user = await client.users.fetch('<user ID>');
await user.send({ content:"Some text1\n",
files: [{ attachment: "img1" }] });
So my question here, if it is possible somehow to change this code or use another one for creating a message in the required format? Preferable if it is all in one message.
Solution
I found the answer to my question (it is not a perfect one but good enough). Solution - to use DiscordJs Embeds. In this case it will be one Discord DM.
For example, for my case:
static getWelcomeMessage() : EmbedBuilder[] {
const part1 = new EmbedBuilder()
.setTitle('Welcome')
.setDescription('<Some description>')
.setImage('<Some image>')
const part2 = new EmbedBuilder()
.setDescription('<Some description>')
.setImage('<Some image>')
const part3 = new EmbedBuilder()
.setDescription('<Some description>')
.setImage('<Some image>')
return [part1, part2, part3]
}
Answered By - Rougher
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.