add read receipts and typing notifications, closes #30

This commit is contained in:
Aine
2022-09-21 11:18:25 +03:00
parent 16c577eeb2
commit c9c871287d
2 changed files with 11 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strings"
"time"
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
@@ -156,6 +157,11 @@ func (b *Bot) handleCommand(ctx context.Context, evt *event.Event, commandSlice
if cmd == nil {
return
}
_, err := b.lp.GetClient().UserTyping(evt.RoomID, true, 30*time.Second)
if err != nil {
b.log.Error("cannot send typing notification: %v", err)
}
defer b.lp.GetClient().UserTyping(evt.RoomID, false, 30*time.Second) //nolint:errcheck
if !cmd.allowed(evt.Sender, evt.RoomID) {
b.SendNotice(ctx, evt.RoomID, "not allowed to do that, kupo")