Check if embed is removed by user
Hello
How can I know if an embed has been removed by the user?
23 Replies
I seen the
deferredResponse.getFollowupMessage(XXX)
but .. how can I get the message ID?the message will be edited and the embed will be gone
you get the ID as part of the interaction response
Which property? 🤔
not sure, but it's in whatever is returned by the creation function
I don't find 🤔
check what the edit/delete function does ig
it will be the id of a followup you created to the intial response - otherwise there are no followups
Ok so, how can I create a followUp 😅?
I found something like:
It's the good way to verify?
What are you trying to achieve here
I'm pretty sure users can't edit bot responses
He can click on the closs at the top right of an embed
and after that, if the bot tries to update the embed, the message is modified but the embed removed (never appears again)
I don't think it makes sense to worry about that
Why would that happen?
Because the buttons continue to work. So in my paginator, the user can continue to change the page, but no info can be display (because embed integration is removed by user), so I would like to cancel the process to stop lifecycle linked to the paginator, returns a error message to the user saying "Integration removed" etc.
A user can't realistically expect an embed to work if they remove the embeds
It doesn't make sense to account for that, you can't prevent every piece of user error
That said, removing embeds triggers a message update event I think? Make sure you checked that
I don't think so 🤔 but maybe it's something to check
of course, but it's also to avoid consuming resources (CPU, RAM) because the paginator don't work anymore
and stop the process consequently
Wouldn't you time it out anyway?
All KordEx paginators time out by default
There is a timeout system, but stop the system instantly when the embed is removed is better than wait X minutes
I doubt it'll be much of a performance problem compared to you polling each followup message from cache
you can bring the embed back by adding
suppressEmbeds = false
to the message (modify) builder
it sets MessageFlag.SuppressEmbeds
in the flags of the message. you should also be able to use that flag to determine when the embeds are removed by a user.That's useful info, gg
oh? interesting thanks I will try
That works, nice
so followup message is not necessary for my need
Ah .. maybe yes to verify if the message is deleted or not
So the mix between:
-
supressEmbed
to keep the integration updated
- LiveMessage to receive information when message is deleted
Resolve my issue, thanks a lot
In the same context, LiveMessage are with preview annotations since .. 2-3 years I think, maybe we should remove the preview state? @LustigerLurchtbh, i have basically never touched those
so i'm not sure how they work
Basically, create a system that listen event from discord and call registered handler if it's not a deletion
I worked on it partially, it was before the add of interaction
GitHub
kord/core/src/commonMain/kotlin/live/LiveMessage.kt at 12f32490ec42...
Idiomatic Kotlin Wrapper for The Discord API. Contribute to kordlib/kord development by creating an account on GitHub.