-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC4139: Bot buttons & conversations #4139
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
- Client rendering prompts
- Bot sending prompts
Note that there is a prerequisite on Extensible Events which needs to be unpicked.
// `type` is the prompt type: "preset" (show a button) or "input" (shown below) | ||
"type": "preset", | ||
// `id` is used by the bot to figure out what prompt the user picked. It is an opaque ID. | ||
"id": "1d6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to indicate that interactions are stateful?
I'd been thinking about a similar-ish system, but making the client just send a m.interaction
event with a bot-defined content (possibly as a sub-key?)
eg. a bot would define something like
// other content stuffs ...
"interactions": [
{
"type": "command",
"metadata": {
"action": "roll",
"dice_type": "1d6"
}
]
When a user clicks this command button, the client sends an event:
{
"type": "m.interaction",
"content": {
"metadata": {
"action": "roll",
"dice_type": "1d6"
},
// reply stuff
}
}
I think, personally, I'd love to see a system that sticks more to existing interaction systems in order to avoid extra maintenance burden, and to make it easier to onboard clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bots can GET the previous event if they don't keep state themselves.
// These are the users who should see the `prompts`. Other users may see something like "you | ||
// do not have permission to reply to this message" instead of prompts. `scope` is optional: | ||
// when not supplied, all users who can see the message can respond. When an empty array, no | ||
// one can respond. Clients SHOULD NOT show prompts to users who are descoped. | ||
"scope": [ | ||
"@alice:example.org", | ||
"@bob:example.org", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed but it would be really nice to generalise this with a whisper MSC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent here is to very much ensure interactions are visible to the room. Bots looking to whisper the user can utilize DMs for now.
The user is then able to click on one of the buttons or submit text through the `input` option. That | ||
reply looks as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if there was just a generic button type that if you clicked, would send an event?
Even better, why can't other things be clicked as a conversation reply (or an argument to a slash command), such as another user, or another event in the room timeline, or another button from another event in the timeline.
Being able to select another button in the timeline as a conversation reply or command argument would unlock a huge door, bots would be able to represent output as different button types. For example, Draupnir would be able to render each individual policy in the response to the equivalent of !rules matching @spam:example.com
as a button, that could be selected as an argument in future commands or interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this sounds wonderful and very much needed indeed, though the scope for the MSC needs to end somewhere. Expansion is possible through other MSCs currently, and as this one progresses maybe it brings concepts into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's my opinion that this would reduce the scope of this MSC and future ones by being able to express them using the "button type primitive" (alternatively presentation type). But I do understand how that can be seen differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm following the suggestion in that case, sorry. I understood your comment to mean supporting different types of input, not reusing buttons for everything (which I'm not sure how that'd even work).
Rendered
In line with matrix-org/matrix-spec#1700, the following disclosure applies:
I am Director of Standards Development at The Matrix.org Foundation C.I.C., Matrix Spec Core Team (SCT) member, employed by Element, and operate the t2bot.io service. This proposal is written and published as operator/developer at t2bot.io.
Fixes matrix-org/matrix-spec#232
See also matrix-org/matrix-spec#1651