about summary refs log tree commit diff
path: root/Utilities
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:33:14 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:33:14 +0100
commit163e2a94f600ffe0f982e3f605264ff2f2fe312b (patch)
treeaf8fb4c8c468dde726a4773b1304aa22c59186ac /Utilities
parentApply syntax style to LibMatrix (diff)
downloadLibMatrix-163e2a94f600ffe0f982e3f605264ff2f2fe312b.tar.xz
Apply syntax style to LibMatrix side projects
Diffstat (limited to '')
-rw-r--r--Utilities/LibMatrix.DebugDataValidationApi/Controllers/ValidationController.cs4
-rw-r--r--Utilities/LibMatrix.DebugDataValidationApi/LibMatrix.DebugDataValidationApi.csproj6
-rw-r--r--Utilities/LibMatrix.DebugDataValidationApi/Program.cs2
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Commands/CmdCommand.cs8
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Commands/DbgAniRainbowTest.cs14
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Commands/HelpCommand.cs6
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs6
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/DevTestBot.cs28
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/DevTestBotConfiguration.cs6
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs6
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Interfaces/CommandContext.cs2
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Interfaces/ICommand.cs6
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/StartupTasks/ServerRoomSizeCalulator.cs14
-rw-r--r--Utilities/LibMatrix.DevTestBot/LibMatrix.DevTestBot.csproj56
-rw-r--r--Utilities/LibMatrix.DevTestBot/Program.cs10
-rw-r--r--Utilities/LibMatrix.DevTestBot/Properties/launchSettings.json1
-rw-r--r--Utilities/LibMatrix.DevTestBot/appsettings.Development.json12
-rw-r--r--Utilities/LibMatrix.DevTestBot/appsettings.json22
-rw-r--r--Utilities/LibMatrix.JsonSerializerContextGenerator/LibMatrix.JsonSerializerContextGenerator.csproj4
-rw-r--r--Utilities/LibMatrix.JsonSerializerContextGenerator/Program.cs2
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/AppServiceConfiguration.cs2
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs3
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Commands/HelpCommand.cs8
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Commands/PingCommand.cs6
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/FileStorageProvider.cs6
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs2
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Interfaces/ICommand.cs6
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj8
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/LibMatrixBotConfiguration.cs2
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs18
30 files changed, 121 insertions, 155 deletions
diff --git a/Utilities/LibMatrix.DebugDataValidationApi/Controllers/ValidationController.cs b/Utilities/LibMatrix.DebugDataValidationApi/Controllers/ValidationController.cs
index 1b93614..3420e56 100644
--- a/Utilities/LibMatrix.DebugDataValidationApi/Controllers/ValidationController.cs
+++ b/Utilities/LibMatrix.DebugDataValidationApi/Controllers/ValidationController.cs
@@ -7,7 +7,6 @@ namespace LibMatrix.DebugDataValidationApi.Controllers;
 [ApiController]
 [Route("/")]
 public class ValidationController(ILogger<ValidationController> logger) : ControllerBase {
-
     [HttpPost("/validate/{type}")]
     public Task<bool> Get([FromRoute] string type, [FromBody] JsonElement content) {
         var t = Type.GetType(type);
@@ -15,7 +14,8 @@ public class ValidationController(ILogger<ValidationController> logger) : Contro
             logger.LogWarning($"Type `{type}` does not exist!");
             throw new ArgumentException($"Unknown type {type}!");
         }
+
         logger.LogInformation($"Validating {type}...");
         return Task.FromResult(content.FindExtraJsonElementFields(t, "$"));
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DebugDataValidationApi/LibMatrix.DebugDataValidationApi.csproj b/Utilities/LibMatrix.DebugDataValidationApi/LibMatrix.DebugDataValidationApi.csproj
index e14b7a1..24fd617 100644
--- a/Utilities/LibMatrix.DebugDataValidationApi/LibMatrix.DebugDataValidationApi.csproj
+++ b/Utilities/LibMatrix.DebugDataValidationApi/LibMatrix.DebugDataValidationApi.csproj
@@ -9,12 +9,12 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
-        <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
+        <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0"/>
+        <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
     </ItemGroup>
 
     <ItemGroup>
-        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" />
+        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj"/>
     </ItemGroup>
 
 </Project>
diff --git a/Utilities/LibMatrix.DebugDataValidationApi/Program.cs b/Utilities/LibMatrix.DebugDataValidationApi/Program.cs
index 2c324d8..1d913b4 100644
--- a/Utilities/LibMatrix.DebugDataValidationApi/Program.cs
+++ b/Utilities/LibMatrix.DebugDataValidationApi/Program.cs
@@ -28,4 +28,4 @@ app.UseAuthorization();
 
 app.MapControllers();
 
-app.Run();
+app.Run();
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Commands/CmdCommand.cs b/Utilities/LibMatrix.DevTestBot/Bot/Commands/CmdCommand.cs
index e690890..89a9033 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Commands/CmdCommand.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Commands/CmdCommand.cs
@@ -8,9 +8,7 @@ public class CmdCommand : ICommand {
     public string Name => "cmd";
     public string Description => "Runs a command on the host system";
 
-    public Task<bool> CanInvoke(CommandContext ctx) {
-        return Task.FromResult(ctx.MessageEvent.Sender.EndsWith(":rory.gay") || ctx.MessageEvent.Sender.EndsWith(":conduit.rory.gay"));
-    }
+    public Task<bool> CanInvoke(CommandContext ctx) => Task.FromResult(ctx.MessageEvent.Sender.EndsWith(":rory.gay") || ctx.MessageEvent.Sender.EndsWith(":conduit.rory.gay"));
 
     public async Task Invoke(CommandContext ctx) {
         var cmd = ctx.Args.Aggregate("\"", (current, arg) => current + arg + " ");
@@ -27,7 +25,7 @@ public class CmdCommand : ICommand {
         // .Split("\n").ToList();
 
         var msg = "";
-        EventIdResponse? msgId = await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent {
+        var msgId = await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent {
             FormattedBody = $"Waiting for command output...",
             Body = msg.RemoveAnsi(),
             Format = "m.notice"
@@ -69,4 +67,4 @@ public class CmdCommand : ICommand {
         //     }
         // }
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Commands/DbgAniRainbowTest.cs b/Utilities/LibMatrix.DevTestBot/Bot/Commands/DbgAniRainbowTest.cs
index c526847..f75c863 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Commands/DbgAniRainbowTest.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Commands/DbgAniRainbowTest.cs
@@ -11,26 +11,22 @@ public class DbgAniRainbowTest(IServiceProvider services, HomeserverProviderServ
     public string Name { get; } = "ani-rainbow";
     public string Description { get; } = "[Debug] animated rainbow :)";
 
-    public async Task<bool> CanInvoke(CommandContext ctx) {
-        return ctx.Room.RoomId == "!hLEefBaYvNfJwcTjmt:rory.gay";
-    }
+    public async Task<bool> CanInvoke(CommandContext ctx) => ctx.Room.RoomId == "!hLEefBaYvNfJwcTjmt:rory.gay";
 
     public async Task Invoke(CommandContext ctx) {
         //255 long string
         // var rainbow = "🟥🟧🟨🟩🟦🟪";
         var rainbow = "M";
         var chars = rainbow;
-        for (var i = 0; i < 76; i++) {
-            chars += rainbow[i % rainbow.Length];
-        }
+        for (var i = 0; i < 76; i++) chars += rainbow[i % rainbow.Length];
 
         Task.Run(async () => {
-            int i = 0;
-            var msg = new MessageBuilder(msgType: "m.notice").WithRainbowString(chars).Build();
+            var i = 0;
+            var msg = new MessageBuilder("m.notice").WithRainbowString(chars).Build();
             var msgEvent = await ctx.Room.SendMessageEventAsync(msg);
 
             while (true) {
-                msg = new MessageBuilder(msgType: "m.notice").WithRainbowString(chars, offset: i * 5).Build();
+                msg = new MessageBuilder("m.notice").WithRainbowString(chars, offset: i * 5).Build();
                 if (i % 50 == 0) {
                     msg.NewContent = null;
                     msg.RelatesTo = null;
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Commands/HelpCommand.cs b/Utilities/LibMatrix.DevTestBot/Bot/Commands/HelpCommand.cs
index 23c4fe2..7ecbeb3 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Commands/HelpCommand.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Commands/HelpCommand.cs
@@ -13,10 +13,8 @@ public class HelpCommand(IServiceProvider services) : ICommand {
         var sb = new StringBuilder();
         sb.AppendLine("Available commands:");
         var commands = services.GetServices<ICommand>().ToList();
-        foreach (var command in commands) {
-            sb.AppendLine($"- {command.Name}: {command.Description}");
-        }
+        foreach (var command in commands) sb.AppendLine($"- {command.Name}: {command.Description}");
 
         await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: sb.ToString()));
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs b/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs
index ba242fe..85c86a3 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs
@@ -7,7 +7,5 @@ public class PingCommand : ICommand {
     public string Name { get; } = "ping";
     public string Description { get; } = "Pong!";
 
-    public async Task Invoke(CommandContext ctx) {
-        await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!"));
-    }
-}
+    public async Task Invoke(CommandContext ctx) => await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!"));
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/DevTestBot.cs b/Utilities/LibMatrix.DevTestBot/Bot/DevTestBot.cs
index 678df27..fa80bfd 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/DevTestBot.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/DevTestBot.cs
@@ -20,7 +20,7 @@ public class DevTestBot : IHostedService {
 
     public DevTestBot(HomeserverProviderService homeserverProviderService, ILogger<DevTestBot> logger,
         DevTestBotConfiguration configuration, IServiceProvider services) {
-        logger.LogInformation("{} instantiated!", this.GetType().Name);
+        logger.LogInformation("{} instantiated!", GetType().Name);
         _homeserverProviderService = homeserverProviderService;
         _logger = logger;
         _configuration = configuration;
@@ -49,7 +49,7 @@ public class DevTestBot : IHostedService {
 
         var syncHelper = new SyncHelper(hs);
 
-        await (hs.GetRoom("!DoHEdFablOLjddKWIp:rory.gay")).JoinAsync();
+        await hs.GetRoom("!DoHEdFablOLjddKWIp:rory.gay").JoinAsync();
 
         // foreach (var room in await hs.GetJoinedRooms()) {
         //     if(room.RoomId is "!OGEhHVWSdvArJzumhm:matrix.org") continue;
@@ -65,29 +65,28 @@ public class DevTestBot : IHostedService {
                     x.Type == "m.room.member" && x.StateKey == hs.UserId);
             _logger.LogInformation(
                 $"Got invite to {args.Key} by {inviteEvent.Sender} with reason: {(inviteEvent.TypedContent as RoomMemberEventContent).Reason}");
-            if (inviteEvent.Sender.EndsWith(":rory.gay") || inviteEvent.Sender == "@mxidupwitch:the-apothecary.club") {
+            if (inviteEvent.Sender.EndsWith(":rory.gay") || inviteEvent.Sender == "@mxidupwitch:the-apothecary.club")
                 try {
                     var senderProfile = await hs.GetProfileAsync(inviteEvent.Sender);
-                    await (hs.GetRoom(args.Key)).JoinAsync(reason: $"I was invited by {senderProfile.DisplayName ?? inviteEvent.Sender}!");
+                    await hs.GetRoom(args.Key).JoinAsync(reason: $"I was invited by {senderProfile.DisplayName ?? inviteEvent.Sender}!");
                 }
                 catch (Exception e) {
                     _logger.LogError("{}", e.ToString());
-                    await (hs.GetRoom(args.Key)).LeaveAsync(reason: "I was unable to join the room: " + e);
+                    await hs.GetRoom(args.Key).LeaveAsync("I was unable to join the room: " + e);
                 }
-            }
         });
         syncHelper.TimelineEventHandlers.Add(async @event => {
             _logger.LogInformation(
-                "Got timeline event in {}: {}", @event.RoomId, @event.ToJson(indent: false, ignoreNull: true));
+                "Got timeline event in {}: {}", @event.RoomId, @event.ToJson(false, true));
 
             var room = hs.GetRoom(@event.RoomId);
             // _logger.LogInformation(eventResponse.ToJson(indent: false));
-            if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message }) {
+            if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message })
                 if (message is { MessageType: "m.text" } && message.Body.StartsWith(_configuration.Prefix)) {
                     var command = _commands.FirstOrDefault(x => x.Name == message.Body.Split(' ')[0][_configuration.Prefix.Length..]);
                     if (command == null) {
                         await room.SendMessageEventAsync(
-                            new RoomMessageEventContent(messageType: "m.text", body: "Command not found!"));
+                            new RoomMessageEventContent("m.text", "Command not found!"));
                         return;
                     }
 
@@ -95,15 +94,12 @@ public class DevTestBot : IHostedService {
                         Room = room,
                         MessageEvent = @event
                     };
-                    if (await command.CanInvoke(ctx)) {
+                    if (await command.CanInvoke(ctx))
                         await command.Invoke(ctx);
-                    }
-                    else {
+                    else
                         await room.SendMessageEventAsync(
-                            new RoomMessageEventContent(messageType: "m.text", body: "You do not have permission to run this command!"));
-                    }
+                            new RoomMessageEventContent("m.text", "You do not have permission to run this command!"));
                 }
-            }
         });
         await syncHelper.RunSyncLoopAsync(cancellationToken: cancellationToken);
     }
@@ -114,4 +110,4 @@ public class DevTestBot : IHostedService {
         _logger.LogInformation("Shutting down bot!");
         return Task.CompletedTask;
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/DevTestBotConfiguration.cs b/Utilities/LibMatrix.DevTestBot/Bot/DevTestBotConfiguration.cs
index ef203cd..dcbc670 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/DevTestBotConfiguration.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/DevTestBotConfiguration.cs
@@ -3,10 +3,8 @@ using Microsoft.Extensions.Configuration;
 namespace LibMatrix.ExampleBot.Bot;
 
 public class DevTestBotConfiguration {
-    public DevTestBotConfiguration(IConfiguration config) {
-        config.GetRequiredSection("Bot").Bind(this);
-    }
+    public DevTestBotConfiguration(IConfiguration config) => config.GetRequiredSection("Bot").Bind(this);
     public string Homeserver { get; set; } = "";
     public string AccessToken { get; set; } = "";
     public string Prefix { get; set; }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs b/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs
index 2c014de..cc866e6 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs
@@ -18,9 +18,7 @@ public class FileStorageProvider : IStorageProvider {
         new Logger<FileStorageProvider>(new LoggerFactory()).LogInformation("test");
         Console.WriteLine($"Initialised FileStorageProvider with path {targetPath}");
         TargetPath = targetPath;
-        if (!Directory.Exists(targetPath)) {
-            Directory.CreateDirectory(targetPath);
-        }
+        if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath);
     }
 
     public async Task SaveObjectAsync<T>(string key, T value) => await File.WriteAllTextAsync(Path.Join(TargetPath, key), value?.ToJson());
@@ -35,4 +33,4 @@ public class FileStorageProvider : IStorageProvider {
         File.Delete(Path.Join(TargetPath, key));
         return Task.CompletedTask;
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/CommandContext.cs b/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/CommandContext.cs
index 6dbb7f9..90a95e4 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/CommandContext.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/CommandContext.cs
@@ -8,4 +8,4 @@ public class CommandContext {
     public StateEventResponse MessageEvent { get; set; }
     public string CommandName => (MessageEvent.TypedContent as RoomMessageEventContent).Body.Split(' ')[0][1..];
     public string[] Args => (MessageEvent.TypedContent as RoomMessageEventContent).Body.Split(' ')[1..];
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/ICommand.cs b/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/ICommand.cs
index 2ba5a27..a6dc8da 100644
--- a/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/ICommand.cs
+++ b/Utilities/LibMatrix.DevTestBot/Bot/Interfaces/ICommand.cs
@@ -4,9 +4,7 @@ public interface ICommand {
     public string Name { get; }
     public string Description { get; }
 
-    public Task<bool> CanInvoke(CommandContext ctx) {
-        return Task.FromResult(true);
-    }
+    public Task<bool> CanInvoke(CommandContext ctx) => Task.FromResult(true);
 
     public Task Invoke(CommandContext ctx);
-}
+}
\ No newline at end of file
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
diff --git a/Utilities/LibMatrix.DevTestBot/LibMatrix.DevTestBot.csproj b/Utilities/LibMatrix.DevTestBot/LibMatrix.DevTestBot.csproj
index c0be661..6518c67 100644
--- a/Utilities/LibMatrix.DevTestBot/LibMatrix.DevTestBot.csproj
+++ b/Utilities/LibMatrix.DevTestBot/LibMatrix.DevTestBot.csproj
@@ -1,33 +1,33 @@
 <Project Sdk="Microsoft.NET.Sdk">

 

-  <PropertyGroup>

-    <OutputType>Exe</OutputType>

-    <TargetFramework>net8.0</TargetFramework>

-    <LangVersion>preview</LangVersion>

-    <ImplicitUsings>enable</ImplicitUsings>

-    <Nullable>enable</Nullable>

-    <PublishAot>false</PublishAot>

-    <InvariantGlobalization>true</InvariantGlobalization>

-    <RootNamespace>LibMatrix.ExampleBot</RootNamespace>

-<!--    <PublishTrimmed>true</PublishTrimmed>-->

-<!--    <PublishReadyToRun>true</PublishReadyToRun>-->

-<!--    <PublishSingleFile>true</PublishSingleFile>-->

-<!--    <PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>-->

-<!--    <PublishTrimmedShowLinkerSizeComparison>true</PublishTrimmedShowLinkerSizeComparison>-->

-<!--    <PublishTrimmedShowLinkerSizeComparisonWarnings>true</PublishTrimmedShowLinkerSizeComparisonWarnings>-->

-  </PropertyGroup>

+    <PropertyGroup>

+        <OutputType>Exe</OutputType>

+        <TargetFramework>net8.0</TargetFramework>

+        <LangVersion>preview</LangVersion>

+        <ImplicitUsings>enable</ImplicitUsings>

+        <Nullable>enable</Nullable>

+        <PublishAot>false</PublishAot>

+        <InvariantGlobalization>true</InvariantGlobalization>

+        <RootNamespace>LibMatrix.ExampleBot</RootNamespace>

+        <!--    <PublishTrimmed>true</PublishTrimmed>-->

+        <!--    <PublishReadyToRun>true</PublishReadyToRun>-->

+        <!--    <PublishSingleFile>true</PublishSingleFile>-->

+        <!--    <PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>-->

+        <!--    <PublishTrimmedShowLinkerSizeComparison>true</PublishTrimmedShowLinkerSizeComparison>-->

+        <!--    <PublishTrimmedShowLinkerSizeComparisonWarnings>true</PublishTrimmedShowLinkerSizeComparisonWarnings>-->

+    </PropertyGroup>

 

-  <ItemGroup>

-      <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" />

-  </ItemGroup>

+    <ItemGroup>

+        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj"/>

+    </ItemGroup>

 

-  <ItemGroup>

-    <PackageReference Include="ArcaneLibs.StringNormalisation" Version="1.0.0-preview7205256004.28c0e5a" />

-    <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />

-  </ItemGroup>

-  <ItemGroup>

-    <Content Include="appsettings*.json">

-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>

-    </Content>

-  </ItemGroup>

+    <ItemGroup>

+        <PackageReference Include="ArcaneLibs.StringNormalisation" Version="1.0.0-preview7205256004.28c0e5a"/>

+        <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>

+    </ItemGroup>

+    <ItemGroup>

+        <Content Include="appsettings*.json">

+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+        </Content>

+    </ItemGroup>

 </Project>

diff --git a/Utilities/LibMatrix.DevTestBot/Program.cs b/Utilities/LibMatrix.DevTestBot/Program.cs
index b53bbfb..eb5ad76 100644
--- a/Utilities/LibMatrix.DevTestBot/Program.cs
+++ b/Utilities/LibMatrix.DevTestBot/Program.cs
@@ -11,10 +11,10 @@ Console.WriteLine("Hello, World!");
 
 var host = Host.CreateDefaultBuilder(args).ConfigureServices((_, services) => {
     // services.AddScoped<TieredStorageService>(x =>
-        // new TieredStorageService(
-            // cacheStorageProvider: new FileStorageProvider("bot_data/cache/"),
-            // dataStorageProvider: new FileStorageProvider("bot_data/data/")
-        // )
+    // new TieredStorageService(
+    // cacheStorageProvider: new FileStorageProvider("bot_data/cache/"),
+    // dataStorageProvider: new FileStorageProvider("bot_data/data/")
+    // )
     // );
     services.AddScoped<DevTestBotConfiguration>();
     services.AddRoryLibMatrixServices();
@@ -27,4 +27,4 @@ var host = Host.CreateDefaultBuilder(args).ConfigureServices((_, services) => {
     services.AddHostedService<DevTestBot>();
 }).UseConsoleLifetime().Build();
 
-await host.RunAsync();
+await host.RunAsync();
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/Properties/launchSettings.json b/Utilities/LibMatrix.DevTestBot/Properties/launchSettings.json
index 997e294..6c504ff 100644
--- a/Utilities/LibMatrix.DevTestBot/Properties/launchSettings.json
+++ b/Utilities/LibMatrix.DevTestBot/Properties/launchSettings.json
@@ -5,7 +5,6 @@
       "commandName": "Project",
       "dotnetRunMessages": true,
       "environmentVariables": {
-
       }
     },
     "Development": {
diff --git a/Utilities/LibMatrix.DevTestBot/appsettings.Development.json b/Utilities/LibMatrix.DevTestBot/appsettings.Development.json
index 27bbd50..f999bc2 100644
--- a/Utilities/LibMatrix.DevTestBot/appsettings.Development.json
+++ b/Utilities/LibMatrix.DevTestBot/appsettings.Development.json
@@ -1,9 +1,9 @@
 {
-    "Logging": {
-        "LogLevel": {
-            "Default": "Debug",
-            "System": "Information",
-            "Microsoft": "Information"
-        }
+  "Logging": {
+    "LogLevel": {
+      "Default": "Debug",
+      "System": "Information",
+      "Microsoft": "Information"
     }
+  }
 }
\ No newline at end of file
diff --git a/Utilities/LibMatrix.DevTestBot/appsettings.json b/Utilities/LibMatrix.DevTestBot/appsettings.json
index 6613979..db64c22 100644
--- a/Utilities/LibMatrix.DevTestBot/appsettings.json
+++ b/Utilities/LibMatrix.DevTestBot/appsettings.json
@@ -1,14 +1,14 @@
 {
-    "Logging": {
-        "LogLevel": {
-            "Default": "Debug",
-            "System": "Information",
-            "Microsoft": "Information"
-        }
-    },
-    "Bot": {
-        "Homeserver": "rory.gay",
-        "AccessToken": "syt_xxxxxxxxxxxxxxxxx",
-        "Prefix": "!"
+  "Logging": {
+    "LogLevel": {
+      "Default": "Debug",
+      "System": "Information",
+      "Microsoft": "Information"
     }
+  },
+  "Bot": {
+    "Homeserver": "rory.gay",
+    "AccessToken": "syt_xxxxxxxxxxxxxxxxx",
+    "Prefix": "!"
+  }
 }
\ No newline at end of file
diff --git a/Utilities/LibMatrix.JsonSerializerContextGenerator/LibMatrix.JsonSerializerContextGenerator.csproj b/Utilities/LibMatrix.JsonSerializerContextGenerator/LibMatrix.JsonSerializerContextGenerator.csproj
index b90bf20..35cb9f8 100644
--- a/Utilities/LibMatrix.JsonSerializerContextGenerator/LibMatrix.JsonSerializerContextGenerator.csproj
+++ b/Utilities/LibMatrix.JsonSerializerContextGenerator/LibMatrix.JsonSerializerContextGenerator.csproj
@@ -8,8 +8,8 @@
     </PropertyGroup>
 
     <ItemGroup>
-      <ProjectReference Include="..\..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj" />
-      <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" />
+        <ProjectReference Include="..\..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj"/>
+        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj"/>
     </ItemGroup>
 
 </Project>
diff --git a/Utilities/LibMatrix.JsonSerializerContextGenerator/Program.cs b/Utilities/LibMatrix.JsonSerializerContextGenerator/Program.cs
index 0c0277b..f33efeb 100644
--- a/Utilities/LibMatrix.JsonSerializerContextGenerator/Program.cs
+++ b/Utilities/LibMatrix.JsonSerializerContextGenerator/Program.cs
@@ -23,7 +23,7 @@ stream.WriteString("\n\nnamespace LibMatrix.Generated;\n\n[JsonSourceGenerationO
 //
 //                   """)));
 
-stream.WriteString(string.Join('\n', eventContentTypes//.DistinctBy(x => x.Namespace)
+stream.WriteString(string.Join('\n', eventContentTypes //.DistinctBy(x => x.Namespace)
     .Select(x => $"[JsonSerializable(typeof({x.Name}))]")));
 
 stream.WriteString("\ninternal partial class EventTypeSerializerContext : JsonSerializerContext { }");
diff --git a/Utilities/LibMatrix.Utilities.Bot/AppServiceConfiguration.cs b/Utilities/LibMatrix.Utilities.Bot/AppServiceConfiguration.cs
index d8d1094..afda89e 100644
--- a/Utilities/LibMatrix.Utilities.Bot/AppServiceConfiguration.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/AppServiceConfiguration.cs
@@ -84,4 +84,4 @@ public class AppServiceConfiguration {
 
         return yaml;
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs b/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs
index 25a8d92..eb67424 100644
--- a/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/BotCommandInstaller.cs
@@ -34,6 +34,7 @@ public static class BotCommandInstaller {
             services.AddHostedService<CommandListenerHostedService>();
             // services.AddSingleton<IHostedService, CommandListenerHostedService>();
         }
+
         return services;
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/Commands/HelpCommand.cs b/Utilities/LibMatrix.Utilities.Bot/Commands/HelpCommand.cs
index 4fe1038..9937b3c 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Commands/HelpCommand.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Commands/HelpCommand.cs
@@ -13,10 +13,8 @@ public class HelpCommand(IServiceProvider services) : ICommand {
         var sb = new StringBuilder();
         sb.AppendLine("Available commands:");
         var commands = services.GetServices<ICommand>().ToList();
-        foreach (var command in commands) {
-            sb.AppendLine($"- {command.Name}: {command.Description}");
-        }
+        foreach (var command in commands) sb.AppendLine($"- {command.Name}: {command.Description}");
 
-        await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(messageType: "m.notice", body: sb.ToString()));
+        await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent("m.notice", sb.ToString()));
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/Commands/PingCommand.cs b/Utilities/LibMatrix.Utilities.Bot/Commands/PingCommand.cs
index 16712ea..b5fb868 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Commands/PingCommand.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Commands/PingCommand.cs
@@ -7,7 +7,5 @@ public class PingCommand : ICommand {
     public string Name { get; } = "ping";
     public string Description { get; } = "Pong!";
 
-    public async Task Invoke(CommandContext ctx) {
-        await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!"));
-    }
-}
+    public async Task Invoke(CommandContext ctx) => await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!"));
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/FileStorageProvider.cs b/Utilities/LibMatrix.Utilities.Bot/FileStorageProvider.cs
index b66fbf5..b762937 100644
--- a/Utilities/LibMatrix.Utilities.Bot/FileStorageProvider.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/FileStorageProvider.cs
@@ -14,9 +14,7 @@ public class FileStorageProvider : IStorageProvider {
     public FileStorageProvider(string targetPath) {
         Console.WriteLine($"Initialised FileStorageProvider with path {targetPath}");
         TargetPath = targetPath;
-        if (!Directory.Exists(targetPath)) {
-            Directory.CreateDirectory(targetPath);
-        }
+        if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath);
     }
 
     public async Task SaveObjectAsync<T>(string key, T value) => await File.WriteAllTextAsync(Path.Join(TargetPath, key), value?.ToJson());
@@ -31,4 +29,4 @@ public class FileStorageProvider : IStorageProvider {
         File.Delete(Path.Join(TargetPath, key));
         return Task.CompletedTask;
     }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
index 94ea846..e65f86d 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
@@ -19,4 +19,4 @@ public class CommandContext {
     public required AuthenticatedHomeserverGeneric Homeserver { get; set; }
 
     public async Task<EventIdResponse> Reply(RoomMessageEventContent content) => await Room.SendMessageEventAsync(content);
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/Interfaces/ICommand.cs b/Utilities/LibMatrix.Utilities.Bot/Interfaces/ICommand.cs
index 82439e8..453a8fe 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Interfaces/ICommand.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Interfaces/ICommand.cs
@@ -4,9 +4,7 @@ public interface ICommand {
     public string Name { get; }
     public string Description { get; }
 
-    public Task<bool> CanInvoke(CommandContext ctx) {
-        return Task.FromResult(true);
-    }
+    public Task<bool> CanInvoke(CommandContext ctx) => Task.FromResult(true);
 
     public Task Invoke(CommandContext ctx);
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
index e16c00c..89ea5af 100644
--- a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
+++ b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
@@ -8,13 +8,13 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" />
+        <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj"/>
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
-        <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
-        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
+        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0"/>
+        <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
+        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
     </ItemGroup>
 
 
diff --git a/Utilities/LibMatrix.Utilities.Bot/LibMatrixBotConfiguration.cs b/Utilities/LibMatrix.Utilities.Bot/LibMatrixBotConfiguration.cs
index 27ce06b..d607637 100644
--- a/Utilities/LibMatrix.Utilities.Bot/LibMatrixBotConfiguration.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/LibMatrixBotConfiguration.cs
@@ -8,4 +8,4 @@ public class LibMatrixBotConfiguration {
     public string AccessToken { get; set; } = "";
     public string Prefix { get; set; } = "?";
     public string? LogRoom { get; set; }
-}
+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
index 9949631..11ee740 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
@@ -18,7 +18,7 @@ public class CommandListenerHostedService : IHostedService {
 
     public CommandListenerHostedService(AuthenticatedHomeserverGeneric hs, ILogger<CommandListenerHostedService> logger, IServiceProvider services,
         LibMatrixBotConfiguration config) {
-        logger.LogInformation("{} instantiated!", this.GetType().Name);
+        logger.LogInformation("{} instantiated!", GetType().Name);
         _hs = hs;
         _logger = logger;
         _config = config;
@@ -44,7 +44,7 @@ public class CommandListenerHostedService : IHostedService {
             try {
                 var room = _hs.GetRoom(@event.RoomId);
                 // _logger.LogInformation(eventResponse.ToJson(indent: false));
-                if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message }) {
+                if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message })
                     if (message is { MessageType: "m.text" }) {
                         var messageContentWithoutReply =
                             message.Body.Split('\n', StringSplitOptions.RemoveEmptyEntries).SkipWhile(x => x.StartsWith(">")).Aggregate((x, y) => $"{x}\n{y}");
@@ -52,7 +52,7 @@ public class CommandListenerHostedService : IHostedService {
                             var command = _commands.FirstOrDefault(x => x.Name == messageContentWithoutReply.Split(' ')[0][_config.Prefix.Length..]);
                             if (command == null) {
                                 await room.SendMessageEventAsync(
-                                    new RoomMessageEventContent(messageType: "m.notice", body: "Command not found!"));
+                                    new RoomMessageEventContent("m.notice", "Command not found!"));
                                 return;
                             }
 
@@ -62,7 +62,7 @@ public class CommandListenerHostedService : IHostedService {
                                 Homeserver = _hs
                             };
 
-                            if (await command.CanInvoke(ctx)) {
+                            if (await command.CanInvoke(ctx))
                                 try {
                                     await command.Invoke(ctx);
                                 }
@@ -70,14 +70,11 @@ public class CommandListenerHostedService : IHostedService {
                                     await room.SendMessageEventAsync(
                                         MessageFormatter.FormatException("An error occurred during the execution of this command", e));
                                 }
-                            }
-                            else {
+                            else
                                 await room.SendMessageEventAsync(
-                                    new RoomMessageEventContent(messageType: "m.notice", body: "You do not have permission to run this command!"));
-                            }
+                                    new RoomMessageEventContent("m.notice", "You do not have permission to run this command!"));
                         }
                     }
-                }
             }
             catch (Exception e) {
                 _logger.LogError(e, "Error in command listener!");
@@ -94,6 +91,7 @@ public class CommandListenerHostedService : IHostedService {
             _logger.LogError("Could not shut down command listener task because it was null!");
             return;
         }
+
         await _listenerTask.WaitAsync(cancellationToken);
     }
-}
+}
\ No newline at end of file