#buttons without miru

1 messages · Page 1 of 1 (latest)

gritty viper
#

How can I add buttons to a message without miru

gritty viper
#

I can't get it to work. Can you provide example

cosmic hamlet
# gritty viper I can't get it to work. Can you provide example

sure ```py

create a new action row

action_row = bot.rest.build_message_action_row()

add a button

action_row.add_button(hikari.ButtonStyle.PRIMARY, "my_button").set_label("Click on me!").add_to_container()

adding a new button to the container, the add_to_container is important

sending the component

await your_send_method("Here's a cool button!", component=action_row)

#

you can build upto 5 action rows for a message and send them using components arg in your respond method

gritty viper
#

Thanks, so i needed to .add_to_container()

#

Now it works

cosmic hamlet
#

great!

gritty viper
# cosmic hamlet great!

How do I make sure the person who ran the command is clicking on the button?
Otherwise don't do anything

cosmic hamlet
gritty viper
#

Can you tell me how

cosmic hamlet
gritty viper
cosmic hamlet
#

yes

cosmic hamlet
gritty viper
#

I can have multiple buttons so in that case?

cosmic hamlet
#

yeah that won't work for you then

#

you can probably create a cache mapping that stores message id key with command author values