diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2023-10-11 12:45:44 +0200 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2023-10-11 12:45:44 +0200 |
commit | e30d12515e00347be2e8adb9e6dcde2ec49b3642 (patch) | |
tree | 3a142b5be07809cfb6d5ffa8ce78f1664c652105 /OsuFederatedBeatmapApi/Services | |
parent | Initial commit (diff) | |
download | OsuFederatedBeatmapApi-e30d12515e00347be2e8adb9e6dcde2ec49b3642.tar.xz |
Changes?
Diffstat (limited to 'OsuFederatedBeatmapApi/Services')
-rw-r--r-- | OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBot.cs | 7 | ||||
-rw-r--r-- | OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBotAccountDataService.cs | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBot.cs b/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBot.cs index 2b39d93..04d64ad 100644 --- a/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBot.cs +++ b/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBot.cs @@ -45,6 +45,9 @@ public class FederatedBeatmapApiBot(AuthenticatedHomeserverGeneric hs, }, cancellationToken); #pragma warning restore CS4014 + foreach (var inviteTask in admins.Select(x=>accountDataService.ControlRoom.InviteUserAsync(x))) await inviteTask; + foreach (var inviteTask in admins.Select(x=>accountDataService.LogRoom.InviteUserAsync(x))) await inviteTask; + syncHelper.InviteReceivedHandlers.Add(async Task (args) => { var inviteEvent = args.Value.InviteState.Events.FirstOrDefault(x => @@ -69,7 +72,9 @@ public class FederatedBeatmapApiBot(AuthenticatedHomeserverGeneric hs, logger.LogInformation( "Got timeline event in {}: {}", @event.RoomId, @event.ToJson(indent: true, ignoreNull: true)); - if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message }) { } + if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message }) { + + } } catch (Exception e) { logger.LogError("{}", e.ToString()); diff --git a/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBotAccountDataService.cs b/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBotAccountDataService.cs index 0f4aa6a..37b0d67 100644 --- a/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBotAccountDataService.cs +++ b/OsuFederatedBeatmapApi/Services/FederatedBeatmapApiBotAccountDataService.cs @@ -12,9 +12,10 @@ public class FederatedBeatmapApiBotAccountDataService(ILogger<FederatedBeatmapAp public GenericRoom LogRoom; public GenericRoom ControlRoom; + public List<GenericRoom> ListedRepositories; private BotData botData; - public async Task LoadAccountData() { + public async Task LoadAccountDataAsync() { try { botData = await hs.GetAccountDataAsync<BotData>(BotDataKey); } @@ -56,5 +57,6 @@ public class FederatedBeatmapApiBotAccountDataService(ILogger<FederatedBeatmapAp LogRoom = hs.GetRoom(botData.LogRoom ?? botData.ControlRoom); ControlRoom = hs.GetRoom(botData.ControlRoom); + ListedRepositories = botData.ListedRepositories.Select(hs.GetRoom).ToList(); } } |