What event was called when bot started?

I can`t found it(
Solution:
then listen for the ButtonInteractionCreateEvent
Jump to solution
19 Replies
gdude
gdude3mo ago
This isn't as simple a question as you think What are you trying to do?
noBrain
noBrainOP3mo ago
I want to make an authorization system; when the bot starts, I need to send a message with a button to a certain channel and when the button is clicked, open a modal window. I'm thinking about rebooting, but I'm not sure if I can connect to an existing message (Buttons) In the modal window you will need to enter the game nickname, after confirmation I will add the received data to the database
gdude
gdude3mo ago
OK, you need a button-based authorisation system, do you know what the channel type, ID and guild are ahead of time?
noBrain
noBrainOP3mo ago
ye, it`s my guild I will make config for settings
gdude
gdude3mo ago
I'd recommend using a command instead of sending a message on every startup but if you really can't get away from that, you could use the GuildCreateEvent or maybe the ReadyEvent if you don't need anything in your cache
noBrain
noBrainOP3mo ago
I thought about this, but most likely we will have an automatic nightly reboot and the modal window will fall off (
gdude
gdude3mo ago
That shouldn't be a problem
noBrain
noBrainOP3mo ago
Okay, thanks a lot for your help
gdude
gdude3mo ago
Create your button using actionRow {} instead of components {}
Solution
gdude
gdude3mo ago
then listen for the ButtonInteractionCreateEvent
gdude
gdude3mo ago
you can do the same thing for modals (ModalSubmitInteractionCreateEvent)
noBrain
noBrainOP3mo ago
Will it work after reboot?
gdude
gdude3mo ago
yep
noBrain
noBrainOP3mo ago
tysm
gdude
gdude3mo ago
the main thing to bear in mind is the customId you give the button
noBrain
noBrainOP3mo ago
okay
gdude
gdude3mo ago
you can match against that in your event handler again, same thing for modals
noBrain
noBrainOP3mo ago
:pepe: Okay, i will try it
gdude
gdude3mo ago
Alright, glad to have helped haha oh, and if it helps, I wrote a bot recently that basically does exactly this that code is here, though do note the license https://github.com/cmc-discord/bot-invites-kotlin/blob/root/src/main/kotlin/wiki/moderation/bot/invites/extensions/InviteExtension.kt

Did you find this page helpful?