Update example again

This commit is contained in:
Tulir Asokan 2023-12-15 16:25:28 +02:00
commit 96b4001106
3 changed files with 6 additions and 6 deletions

View file

@ -1,12 +1,12 @@
module maunium.net/go/mautrix/example
go 1.19
go 1.20
require (
github.com/chzyer/readline v1.5.1
github.com/mattn/go-sqlite3 v1.14.18
github.com/rs/zerolog v1.31.0
maunium.net/go/mautrix v0.16.3-0.20231215135638-893afc725981
maunium.net/go/mautrix v0.16.3-0.20231215142331-753cdb2e1cb0
)
require (

View file

@ -47,5 +47,5 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
maunium.net/go/maulogger/v2 v2.4.1 h1:N7zSdd0mZkB2m2JtFUsiGTQQAdP0YeFWT7YMc80yAL8=
maunium.net/go/maulogger/v2 v2.4.1/go.mod h1:omPuYwYBILeVQobz8uO3XC8DIRuEb5rXYlQSuqrbCho=
maunium.net/go/mautrix v0.16.3-0.20231215135638-893afc725981 h1:KrMb5QyuMh2ZqfRLFiKRhYRV95aPCpaAepOful5EHvg=
maunium.net/go/mautrix v0.16.3-0.20231215135638-893afc725981/go.mod h1:YL4l4rZB46/vj/ifRMEjcibbvHjgxHftOF1SgmruLu4=
maunium.net/go/mautrix v0.16.3-0.20231215142331-753cdb2e1cb0 h1:2ZWtBcTScQfMwpcoGeY4mLYXC6OmYN/4Qh2yhBiVNV4=
maunium.net/go/mautrix v0.16.3-0.20231215142331-753cdb2e1cb0/go.mod h1:YL4l4rZB46/vj/ifRMEjcibbvHjgxHftOF1SgmruLu4=

View file

@ -74,7 +74,7 @@ func main() {
})
syncer.OnEventType(event.StateMember, func(source mautrix.EventSource, evt *event.Event) {
if evt.GetStateKey() == client.UserID.String() && evt.Content.AsMember().Membership == event.MembershipInvite {
_, err := client.JoinRoomByID(evt.RoomID)
_, err := client.JoinRoomByID(context.TODO(), evt.RoomID)
if err == nil {
lastRoomID = evt.RoomID
rl.SetPrompt(fmt.Sprintf("%s> ", lastRoomID))
@ -137,7 +137,7 @@ func main() {
log.Error().Msg("Wait for an incoming message before sending messages")
continue
}
resp, err := client.SendText(lastRoomID, line)
resp, err := client.SendText(context.TODO(), lastRoomID, line)
if err != nil {
log.Error().Err(err).Msg("Failed to send event")
} else {