Linda-Momma
Linda-Momma

Reputation: 1

Dynamic help cmd to be embed

I’m very new to this. I use a lot of copy-pasta!

I followed a discord.js tutorial and it helped me set up the help command. The dynamic one but it looks terrible.

It runs perfect. I already have embeds for my main commands etc. and those perform great I could probably just turn them into DMs.

But this complete list of commands is so great I really want to use it just tweak it a bit to be more aesthetic! Because of its dynamic ability to always add commands to the list for me. So...

  1. How can I make the dynamic help be an DM embed.
  2. How can I make the dynamic help show categories (main commands and their sub commands)

Or should I scrap it all together and make a DM embed with a list on my own? How would I make it dynamic and update the embed with new commands that I add.

(I’m still learning terms and such I am fully prepared to spiral in codes and links for the rest of the week).

Upvotes: 0

Views: 40

Answers (1)

Super Phantom User
Super Phantom User

Reputation: 85

Embeds have a lot of properties and allow you to mix them up a lot.

To DM an embed, do:

message.author.send(embed).catch(err => {
   message.channel.send(embed);
});

Make sure to include the catch, otherwise, if the user's DMs are closed you'll run into an error.

You can also use inline fields using the addFields method:

embed.addFields(
    {name: "Moderation", value: "Commands that protect your server", inline: true},
    {name: "Fun", value: "Fun and exciting commands", inline: true},
    {name: "Music", value: "Listen to music in voice channels", inline: true}
);

When using inline fields, they all are aligned with each other, instead of being right after each other.

Upvotes: 0

Related Questions