#How do you make a button for a link

1 messages · Page 1 of 1 (latest)

near drum
#

.

patent orioleBOT
river lodge
#

ButtonStyle.Link and then .setURL(…)

near drum
near drum
river lodge
#

What variable?

near drum
#

ButtonStyle

river lodge
#

Import from discord.js

near drum
#

I made a mistake

near drum
river lodge
#

Show invite.js

near drum
#

yes

near drum
# river lodge Show invite.js
const Discord = require("discord.js")

module.exports = {

    name: "invite",
    description: "Inviter le bot dans vorte serveur !",
    permission: "Aucune",
    dm: true,
    category: "Informations",

    async run(bot, message, args) {
 
          let Embed48 = new Discord.EmbedBuilder()
          .setColor("#5288e0")
          .setAuthor({name: `Ajoutez ---- à votre serveur !` , iconURL: `https://cdn.discordapp.com/attachments/1094728427979935835/1095669659509985331/FlutBot.png` , url: `https://discord.gg/----`})
          
          ButtonStyle.Link 
            .setEmoji(":white_check_mark:") 
            .setURL("https://discord.gg/---")
           

          await message.reply({embeds: [Embed48]})
    }                                          
}```
river lodge
#

You don’t import ButtonStyle there… you can destructure it from Discord or simply use Discord.ButtonStyle

river lodge
#

What part?

#

You import the whole library and name it Discord. So all its exports are now properties of Discord. The same way you use the EmbedBuilder export you also need to use the ButtonStyle export

near drum
#

so let ButtonStyle1 = new Discord.ButtonStyle. () ?

#

'm lost in the code forest !

#

Can you give me an example of button code please?

river lodge
#

You literally only have to prepend what you currently have with Discord.
So Discord.ButtonStyle.Link

#

And put that in a .setStyle(…)

#

Oh wait, that is an embed, not a button… why is there no button?

near drum
#

or with all the const.. or following the code

river lodge
#

Just to double check, can you show me a screenshot of what you want to have? Maybe the button link got lost in translation

near drum
#

I want something likeI want something likent that

patent orioleBOT
#

guide Interactions: Button styles
Link, a button that navigates to a URL.
read more

near drum
#

yes Thank you (I am a French I speak with Google Translate)