mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
commands/event: allow overriding mentions when replying
This commit is contained in:
parent
da25a87fc1
commit
e0b1e9b0d3
1 changed files with 10 additions and 6 deletions
|
|
@ -81,12 +81,13 @@ func ParseEvent[MetaType any](ctx context.Context, evt *event.Event) *Event[Meta
|
|||
}
|
||||
|
||||
type ReplyOpts struct {
|
||||
AllowHTML bool
|
||||
AllowMarkdown bool
|
||||
Reply bool
|
||||
Thread bool
|
||||
SendAsText bool
|
||||
Edit id.EventID
|
||||
AllowHTML bool
|
||||
AllowMarkdown bool
|
||||
Reply bool
|
||||
Thread bool
|
||||
SendAsText bool
|
||||
Edit id.EventID
|
||||
OverrideMentions *event.Mentions
|
||||
}
|
||||
|
||||
func (evt *Event[MetaType]) Reply(msg string, args ...any) id.EventID {
|
||||
|
|
@ -110,6 +111,9 @@ func (evt *Event[MetaType]) Respond(msg string, opts ReplyOpts) id.EventID {
|
|||
if opts.Edit != "" {
|
||||
content.SetEdit(opts.Edit)
|
||||
}
|
||||
if opts.OverrideMentions != nil {
|
||||
content.Mentions = opts.OverrideMentions
|
||||
}
|
||||
resp, err := evt.Proc.Client.SendMessageEvent(evt.Ctx, evt.RoomID, event.EventMessage, content)
|
||||
if err != nil {
|
||||
zerolog.Ctx(evt.Ctx).Err(err).Msg("Failed to send reply")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue