kordlib / kord

Idiomatic Kotlin Wrapper for The Discord API
MIT License
929 stars 81 forks source link

Receive message builder result within builder API #461

Open gdude2002 opened 2 years ago

gdude2002 commented 2 years ago

I'm currently running into an issue with KordEx's design, where it's impossible to avoid fully wrapping some Kord APIs to make some things function nicely. Specifically, message create and edit builders provide no way to receive the relevant message object after it's been sent/edited.

This issue suggests adding a callback system for this purpose - callbacks could be added to the builders that will be called once the message has been created/edited and the relevant response has been received from discord.

My primary use-case for this is in KordEx's components system. Currently, it's impossible to make components update themselves by editing the message they were sent in, as it's impossible to pass that reference up the chain to them without entirely recreating a bunch of Kord message create/edit APIs - an approach which would be extremely brittle, confusing and unintuitive.

DRSchlaubi commented 2 years ago

Currently, it's impossible to make components update themselves by editing the message they were sent in,

Seemingly Discord has since added a new method https://dokka.kord.dev/core/dev.kord.core.behavior.interaction/acknowledge-public-update-message.html

Does this apply for your use case?

gdude2002 commented 2 years ago

Nope.