about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Classes/RoomInfo.cs
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-07-24 20:56:42 +0200
committerEmma@Rory& <root@rory.gay>2023-07-24 20:56:42 +0200
commit5495a35403d285007d67f503042720302efdf94c (patch)
tree3db4dc545ce3ad252f82a577ecad4150320c1ba3 /MatrixRoomUtils.Web/Classes/RoomInfo.cs
parentChange max line width from 120 to 180 (diff)
downloadMatrixUtils-5495a35403d285007d67f503042720302efdf94c.tar.xz
Code cleanup
Diffstat (limited to 'MatrixRoomUtils.Web/Classes/RoomInfo.cs')
-rw-r--r--MatrixRoomUtils.Web/Classes/RoomInfo.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/MatrixRoomUtils.Web/Classes/RoomInfo.cs b/MatrixRoomUtils.Web/Classes/RoomInfo.cs

index 5ecc431..f9d5452 100644 --- a/MatrixRoomUtils.Web/Classes/RoomInfo.cs +++ b/MatrixRoomUtils.Web/Classes/RoomInfo.cs
@@ -1,13 +1,14 @@ using MatrixRoomUtils.Core; +using MatrixRoomUtils.Core.Interfaces; using MatrixRoomUtils.Core.Responses; using MatrixRoomUtils.Core.RoomTypes; -namespace MatrixRoomUtils.Web.Classes; +namespace MatrixRoomUtils.Web.Classes; public class RoomInfo { public GenericRoom Room { get; set; } public List<StateEventResponse?> StateEvents { get; init; } = new(); - + public async Task<StateEventResponse?> GetStateEvent(string type, string stateKey = "") { var @event = StateEvents.FirstOrDefault(x => x.Type == type && x.StateKey == stateKey); if (@event is not null) return @event; @@ -23,7 +24,8 @@ public class RoomInfo { if (e is { ErrorCode: "M_NOT_FOUND" }) @event.TypedContent = default!; else throw; } + StateEvents.Add(@event); return @event; } -} \ No newline at end of file +}