diff options
Diffstat (limited to '')
-rw-r--r-- | Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs b/Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs index 0c04d27..253eb37 100644 --- a/Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs +++ b/Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs @@ -36,23 +36,19 @@ public class ServerRoomSizeCalulator : IHostedService { throw; } - await (hs.GetRoom("!DoHEdFablOLjddKWIp:rory.gay")).JoinAsync(); + await hs.GetRoom("!DoHEdFablOLjddKWIp:rory.gay").JoinAsync(); Dictionary<string, int> totalRoomSize = new(); foreach (var room in await hs.GetJoinedRooms()) { var stateList = room.GetFullStateAsync().ToBlockingEnumerable().ToList(); var roomSize = stateList.Count; - if (roomSize > 10000) { - await File.AppendAllLinesAsync("large_rooms.txt", new[] { $"{{ \"{room.RoomId}\", {roomSize} }}," }, cancellationToken); - } + if (roomSize > 10000) await File.AppendAllLinesAsync("large_rooms.txt", new[] { $"{{ \"{room.RoomId}\", {roomSize} }}," }, cancellationToken); var roomHs = room.RoomId.Split(":")[1]; - if (totalRoomSize.ContainsKey(roomHs)) { + if (totalRoomSize.ContainsKey(roomHs)) totalRoomSize[roomHs] += roomSize; - } - else { + else totalRoomSize.Add(roomHs, roomSize); - } _logger.LogInformation($"Got room state for {room.RoomId}!"); } @@ -66,4 +62,4 @@ public class ServerRoomSizeCalulator : IHostedService { _logger.LogInformation("Shutting down bot!"); return Task.CompletedTask; } -} +} \ No newline at end of file |