about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Classes/RoomInfo.cs
diff options
context:
space:
mode:
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 +}