about summary refs log tree commit diff
path: root/LibMatrix/Responses/CreateRoomRequest.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-11-23 05:42:33 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2023-11-23 05:42:33 +0100
commit3e934eee892f69a8f78b94950993000522702769 (patch)
tree6aa0d3d26c9a07a7a3e097fe28abb785400bfbd6 /LibMatrix/Responses/CreateRoomRequest.cs
parentAdd license retroactively, matching where the code originated from (MatrixRoo... (diff)
downloadLibMatrix-3e934eee892f69a8f78b94950993000522702769.tar.xz
Moderation bot work
Diffstat (limited to 'LibMatrix/Responses/CreateRoomRequest.cs')
-rw-r--r--LibMatrix/Responses/CreateRoomRequest.cs41
1 files changed, 40 insertions, 1 deletions
diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs
index 4267094..85db517 100644
--- a/LibMatrix/Responses/CreateRoomRequest.cs
+++ b/LibMatrix/Responses/CreateRoomRequest.cs
@@ -81,9 +81,48 @@ public class CreateRoomRequest {
         return errors;
     }
 
+    public static CreateRoomRequest CreatePublic(AuthenticatedHomeserverGeneric hs, string? name = null, string? roomAliasName = null) {
+        var request = new CreateRoomRequest {
+            Name = name ?? "New public Room",
+            Visibility = "public",
+            CreationContent = new(),
+            PowerLevelContentOverride = new() {
+                EventsDefault = 0,
+                UsersDefault = 0,
+                Kick = 50,
+                Ban = 50,
+                Invite = 25,
+                StateDefault = 10,
+                Redact = 50,
+                NotificationsPl = new() {
+                    Room = 10
+                },
+                Events = new() {
+                    { "m.room.avatar", 50 },
+                    { "m.room.canonical_alias", 50 },
+                    { "m.room.encryption", 100 },
+                    { "m.room.history_visibility", 100 },
+                    { "m.room.name", 50 },
+                    { "m.room.power_levels", 100 },
+                    { "m.room.server_acl", 100 },
+                    { "m.room.tombstone", 100 }
+                },
+                Users = new() {
+                    {
+                        hs.UserId,
+                        101
+                    }
+                }
+            },
+            RoomAliasName = roomAliasName,
+            InitialState = new()
+        };
+
+        return request;
+    }
     public static CreateRoomRequest CreatePrivate(AuthenticatedHomeserverGeneric hs, string? name = null, string? roomAliasName = null) {
         var request = new CreateRoomRequest {
-            Name = name ?? "Private Room",
+            Name = name ?? "New private Room",
             Visibility = "private",
             CreationContent = new(),
             PowerLevelContentOverride = new() {