]> de.git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/infrastructure/powerbot/powerlevels.go
Allow naming rooms in the json config.
[xonotic/xonotic.git] / misc / infrastructure / powerbot / powerlevels.go
index eb11f79084247e3af152b5e4997aaaef2f5319af..c07855e8d0b51a1a2298f13b70c3292ddab7f4bd 100644 (file)
@@ -77,7 +77,7 @@ func allPowerLevels(roomLevels *event.PowerLevelsEventContent) []int {
        return ret
 }
 
-func syncPowerLevels(client *mautrix.Client, room id.RoomID, roomGroup []id.RoomID, scores map[id.RoomID]map[id.UserID]*Score, force bool) {
+func syncPowerLevels(client *mautrix.Client, room id.RoomID, roomGroup []Room, scores map[id.RoomID]map[id.UserID]*Score, force bool) {
        roomLevels := roomPowerLevels[room]
        if roomLevels == nil {
                log.Printf("trying to ensure power levels for room %v, but did not get power level map yet", room)
@@ -131,10 +131,10 @@ func syncPowerLevels(client *mautrix.Client, room id.RoomID, roomGroup []id.Room
                prevLevel := roomLevels.Users[user]
                level, raw := computePowerLevel(roomLevels.UsersDefault, *score)
                for _, otherRoom := range roomGroup {
-                       if otherRoom == room {
+                       if otherRoom.ID == room {
                                continue
                        }
-                       otherScore := scores[otherRoom][user]
+                       otherScore := scores[otherRoom.ID][user]
                        if otherScore == nil {
                                continue
                        }