about summary refs log tree commit diff
path: root/ExampleBots/PluralContactBotPoC
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-12-01 12:16:00 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2023-12-01 12:16:00 +0100
commit71d115dc8e915a620dd935955ba980fcbe421dad (patch)
treeb836f5b0e1b5955bbc08443f8df6d078bd0fa7ea /ExampleBots/PluralContactBotPoC
parentModeration bot work (diff)
downloadLibMatrix-71d115dc8e915a620dd935955ba980fcbe421dad.tar.xz
Cleanup, move ArcaneLibs to submodule instead of parent submodule
Diffstat (limited to '')
-rw-r--r--ExampleBots/PluralContactBotPoC/PluralContactBotPoC.csproj1
-rw-r--r--ExampleBots/PluralContactBotPoC/Program.cs148
2 files changed, 74 insertions, 75 deletions
diff --git a/ExampleBots/PluralContactBotPoC/PluralContactBotPoC.csproj b/ExampleBots/PluralContactBotPoC/PluralContactBotPoC.csproj
index 664ff49..0cd647c 100644
--- a/ExampleBots/PluralContactBotPoC/PluralContactBotPoC.csproj
+++ b/ExampleBots/PluralContactBotPoC/PluralContactBotPoC.csproj
@@ -17,7 +17,6 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <!--      <ProjectReference Include="..\..\..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj" />-->
         <ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj" />
         <ProjectReference Include="..\..\Utilities\LibMatrix.Utilities.Bot\LibMatrix.Utilities.Bot.csproj" />
     </ItemGroup>
diff --git a/ExampleBots/PluralContactBotPoC/Program.cs b/ExampleBots/PluralContactBotPoC/Program.cs
index 49c6c68..f8d93c6 100644
--- a/ExampleBots/PluralContactBotPoC/Program.cs
+++ b/ExampleBots/PluralContactBotPoC/Program.cs
@@ -1,74 +1,74 @@
-// See https://aka.ms/new-console-template for more information

-

-using System.Text.Json;

-using System.Text.Json.Serialization;

-using ArcaneLibs.Extensions;

-using LibMatrix.Services;

-using LibMatrix.Utilities.Bot;

-using Microsoft.Extensions.DependencyInjection;

-using Microsoft.Extensions.Hosting;

-using PluralContactBotPoC;

-using PluralContactBotPoC.Bot;

-

-Console.WriteLine("Hello, World!");

-

-var randomBytes = new byte[32];

-Random.Shared.NextBytes(randomBytes);

-var ASToken = Convert.ToBase64String(randomBytes);

-Random.Shared.NextBytes(randomBytes);

-var HSToken = Convert.ToBase64String(randomBytes);

-

-var asConfig = new AppServiceConfiguration() {

-    Id = "plural_contact_bot",

-    Url = null,

-    SenderLocalpart = "plural_contact_bot",

-    AppserviceToken = ASToken,

-    HomeserverToken = HSToken,

-    Namespaces = new() {

-        Users = new() {

-            new() {

-                Exclusive = false,

-                Regex = "@.*"

-            }

-        },

-        Aliases = new() {

-            new() {

-                Exclusive = false,

-                Regex = "#.*"

-            }

-        },

-        Rooms = new() {

-            new() {

-                Exclusive = false,

-                Regex = "!.*"

-            }

-        }

-    },

-    RateLimited = false,

-    Protocols = new List<string>() { "matrix" }

-};

-

-if(File.Exists("appservice.json"))

-    asConfig = JsonSerializer.Deserialize<AppServiceConfiguration>(File.ReadAllText("appservice.json"))!;

-

-File.WriteAllText("appservice.yaml", asConfig.ToYaml());

-File.WriteAllText("appservice.json", asConfig.ToJson());

-Environment.Exit(0);

-

-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/")

-        )

-    );

-    services.AddSingleton<PluralContactBotConfiguration>();

-    services.AddSingleton<AppServiceConfiguration>();

-

-    services.AddRoryLibMatrixServices();

-    services.AddBot(withCommands: true);

-

-    services.AddHostedService<PluralContactBot>();

-}).UseConsoleLifetime().Build();

-

-await host.RunAsync();

+// See https://aka.ms/new-console-template for more information
+
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using ArcaneLibs.Extensions;
+using LibMatrix.Services;
+using LibMatrix.Utilities.Bot;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using PluralContactBotPoC;
+using PluralContactBotPoC.Bot;
+
+Console.WriteLine("Hello, World!");
+
+var randomBytes = new byte[32];
+Random.Shared.NextBytes(randomBytes);
+var ASToken = Convert.ToBase64String(randomBytes);
+Random.Shared.NextBytes(randomBytes);
+var HSToken = Convert.ToBase64String(randomBytes);
+
+var asConfig = new AppServiceConfiguration() {
+    Id = "plural_contact_bot",
+    Url = null,
+    SenderLocalpart = "plural_contact_bot",
+    AppserviceToken = ASToken,
+    HomeserverToken = HSToken,
+    Namespaces = new() {
+        Users = new() {
+            new() {
+                Exclusive = false,
+                Regex = "@.*"
+            }
+        },
+        Aliases = new() {
+            new() {
+                Exclusive = false,
+                Regex = "#.*"
+            }
+        },
+        Rooms = new() {
+            new() {
+                Exclusive = false,
+                Regex = "!.*"
+            }
+        }
+    },
+    RateLimited = false,
+    Protocols = new List<string>() { "matrix" }
+};
+
+if (File.Exists("appservice.json"))
+    asConfig = JsonSerializer.Deserialize<AppServiceConfiguration>(File.ReadAllText("appservice.json"))!;
+
+File.WriteAllText("appservice.yaml", asConfig.ToYaml());
+File.WriteAllText("appservice.json", asConfig.ToJson());
+Environment.Exit(0);
+
+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/")
+        )
+    );
+    services.AddSingleton<PluralContactBotConfiguration>();
+    services.AddSingleton<AppServiceConfiguration>();
+
+    services.AddRoryLibMatrixServices();
+    services.AddBot(withCommands: true);
+
+    services.AddHostedService<PluralContactBot>();
+}).UseConsoleLifetime().Build();
+
+await host.RunAsync();