help with buttons

is it possible for the bot to send another message after clicking a URL style button?
33 Replies
d.js toolkit
d.js toolkit•3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
@flexyz
@flexyz•3y ago
if you put message's url probably yes
keekztah
keekztahOP•3y ago
so would i need to put the url instead of the customId since theyre the same
@flexyz
@flexyz•3y ago
customId's for button click events if you want it to redirect to somewhere or to a message customId will not helpful for your situation
keekztah
keekztahOP•3y ago
yea ik, after clicking a url button itll take me to the site, but im wondering if it can also edit the initial embed after clicking
@flexyz
@flexyz•3y ago
i didnt used link buttons but i think it will work same as normal button interactions you can check interaction.type to button interaction and interaction.customId for button's id then change embed
keekztah
keekztahOP•3y ago
okay thanks also, @flexyz. is it possible to make a command that sets a tag of a thread?
d.js docs
d.js docs•3y ago
method ThreadChannel#setAppliedTags() Set the applied tags for this channel (only applicable to forum threads)
keekztah
keekztahOP•3y ago
do i just do channel.setAppliedTags or is there a certain way of getting a thread type channel
Manny ⟔
Manny āŸ”ā€¢3y ago
If you don't mind me asking why do you want a url style button rather than secondary Oh sorry I didn't see you mention that
@flexyz
@flexyz•3y ago
i didnt understand
keekztah
keekztahOP•3y ago
huh?
@flexyz
@flexyz•3y ago
if you want to set a tag for a thread channel just channel.setAppliedTags()
keekztah
keekztahOP•3y ago
i want a link style so i can get sent to top gg website but i also want the embed to change into a new one after clicking the button then just the tag id?
@flexyz
@flexyz•3y ago
its takes array of ids ['id'] šŸ‘.
keekztah
keekztahOP•3y ago
oh yea yea ty
Manny ⟔
Manny āŸ”ā€¢3y ago
So incase what @flexyz. Said doesn't work, the more complicated answer would be having it first link to your own website or server which sends a http request to your bot saying that the button's been pressed, and redirecting the user to top gg
keekztah
keekztahOP•3y ago
oh man lol
@flexyz
@flexyz•3y ago
i think link buttons interaction should be work
Manny ⟔
Manny āŸ”ā€¢3y ago
Yeah that would be the easiest if it does But I've never tried it before
mert
mert•3y ago
When will someone reply to my post, sorry for asking it here
keekztah
keekztahOP•3y ago
can u send me a link or example
@flexyz
@flexyz•3y ago
in your interactioncreate event
if(interaction.isButton) {
if(interaction.customId === "/*Your button's id*/") {
//change embed
}
}
if(interaction.isButton) {
if(interaction.customId === "/*Your button's id*/") {
//change embed
}
}
treble/luna
treble/luna•3y ago
Link buttons do not have a customid and will not trigger an interactionCreate event
@flexyz
@flexyz•3y ago
really? damn
Manny ⟔
Manny āŸ”ā€¢3y ago
Yeah then ^ this would be the alternative
@flexyz
@flexyz•3y ago
yeah
keekztah
keekztahOP•3y ago
yea thats why, link button and custom id are the same
treble/luna
treble/luna•3y ago
no they are not. Link buttons do not have a customid, just a url
keekztah
keekztahOP•3y ago
yes im saying it is basically the same, as in you cant use both a link button and a customid button.
keekztah
keekztahOP•3y ago
when i click the buttons, they do what theyre supposed to but it still shows interaction failed?
mert
mert•3y ago
Are you comfortable with showing the code `?
keekztah
keekztahOP•3y ago
what i coded the button to do was show commands from a certain folder. that works but i still get the interaction failed i figured it out thank you

Did you find this page helpful?