]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
Oops, fix the errors.
authorRudolf Polzer <divVerent@gmail.com>
Fri, 18 Feb 2022 00:07:15 +0000 (01:07 +0100)
committerRudolf Polzer <divVerent@gmail.com>
Fri, 18 Feb 2022 00:07:15 +0000 (01:07 +0100)
Now the bot handles kicks right.

misc/infrastructure/powerbot/bot.go

index 2f26ff00c24d2f4dea42d22191cbfc1814cd25f0..4c8b2f53779af59e6558375337b5d20913b2ed1d 100644 (file)
@@ -197,11 +197,16 @@ func Run() (err error) {
                        return
                }
                mem := evt.Content.AsMember()
+               key := evt.StateKey
+               if key == nil {
+                       return
+               }
+               member := id.UserID(*key)
                switch mem.Membership {
                case event.MembershipJoin:
-                       handleJoin(eventTime(evt), evt.RoomID, evt.StateKey, evt)
+                       handleJoin(eventTime(evt), evt.RoomID, member, evt)
                case event.MembershipLeave:
-                       handleLeave(eventTime(evt), evt.RoomID, evt.StateKey, evt)
+                       handleLeave(eventTime(evt), evt.RoomID, member, evt)
                default: // Ignore.
                }
        })