Start message from context
sampaiodiego opened this issue · comments
When creating a message being triggered by a slash command, I found really frustrating having to set the room (and even the thread id) of that message, because I just had to set the properties from the context and set them on the message creator. Since I think this is the most common and expected behavior, it would be nice to have an API that can do that for me, something like:
public async executor(context: SlashCommandContext, read: IRead, modify: IModify): Promise<void> {
const builder = modify.getCreator()
.startMessage()
.fromContext(context)
.setText('My message');
modify.getCreator().finish(builder);
}
This could also be applied to other UIKit contexts, it's a very interesting approach.
Regarding behavior: some contexts (if not all) have a userId
in them. Would you expect this user to be assigned as the sender
of the message? Or would you expect the app user to be the sender (ignoring the user
in the context)?
Regarding behavior: some contexts (if not all) have a
userId
in them. Would you expect this user to be assigned as thesender
of the message? Or would you expect the app user to be the sender (ignoring theuser
in the context)?
I'd say the app user should be used as sender by default, but I can see it may look inconsistent. 🤔
@d-gubert Can I take this issue up?
The .fromContext()
function will be able to take in contexts (types) which have the user and the room in them.
I'd say the app user should be used as sender by default, but I can see it may look inconsistent. 🤔
Also, can you please tell me who should be default sender when using this function.