From 5495a35403d285007d67f503042720302efdf94c Mon Sep 17 00:00:00 2001 From: "Emma@Rory&" Date: Mon, 24 Jul 2023 20:56:42 +0200 Subject: Code cleanup --- MatrixRoomUtils.Web/Classes/RoomInfo.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'MatrixRoomUtils.Web/Classes/RoomInfo.cs') 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 StateEvents { get; init; } = new(); - + public async Task 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 +} -- cgit 1.5.1