~edwargix/axon

4ebf11e3ba7ee3e8d2761879053650c76718fcfd — David Florness 3 years ago 6942d4e
echo: create filter limited to room when room ID is provided
1 files changed, 18 insertions(+), 0 deletions(-)

M echo/cmd.go
M echo/cmd.go => echo/cmd.go +18 -0
@@ 55,5 55,23 @@ func echo(roomID *id.RoomID) error {
			source)
	})

	if roomID != nil {
		// same as
		// https://github.com/tulir/mautrix-go/blob/v0.9.12/sync.go#L233
		// but filtered to room
		res, err := client.CreateFilter(&mautrix.Filter{
			Room: mautrix.RoomFilter{
				Timeline: mautrix.FilterPart{
					Limit: 50,
					Rooms: []id.RoomID{*roomID},
				},
			},
		})
		if err != nil {
			return err
		}
		client.Store.SaveFilterID(client.UserID, res.FilterID)
	}

	return client.Sync()
}