From 82e5660b63ea6466e22f855fe524b288b62da7f9 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 18 May 2025 22:52:39 +0200 Subject: More stuff --- MiniUtils/Commands/DeleteRoomCommand.cs | 36 +++++---------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) (limited to 'MiniUtils/Commands/DeleteRoomCommand.cs') diff --git a/MiniUtils/Commands/DeleteRoomCommand.cs b/MiniUtils/Commands/DeleteRoomCommand.cs index 41dbfb3..8d02dfb 100644 --- a/MiniUtils/Commands/DeleteRoomCommand.cs +++ b/MiniUtils/Commands/DeleteRoomCommand.cs @@ -1,9 +1,4 @@ -using ArcaneLibs.Extensions; -using LibMatrix.EventTypes.Common; -using LibMatrix.EventTypes.Spec.State.RoomInfo; -using LibMatrix.Helpers; -using LibMatrix.Responses; -using LibMatrix.RoomTypes; +using LibMatrix.Homeservers; using LibMatrix.Utilities.Bot.Interfaces; namespace MiniUtils.Commands; @@ -18,30 +13,9 @@ public class DeleteRoomCommand() : ICommand { public bool Unlisted => false; public async Task Invoke(CommandContext ctx) { - var creationContent = new CreateRoomRequest() { - Name = ctx.Args[0], - RoomAliasName = ctx.Args[0], - Visibility = "private", - CreationContent = new() { - { "type", PolicyRoom.TypeName }, - { "room_version", 11 } - }, - PowerLevelContentOverride = new RoomPowerLevelEventContent() { - EventsDefault = 50, - Invite = 50 - }, - InitialState = [ - new() { - Type = MjolnirShortcodeEventContent.EventId, - StateKey = "", - TypedContent = new MjolnirShortcodeEventContent() { - Shortcode = ctx.Args[0] - } - } - ] - }; - - var result = await ctx.Homeserver.CreateRoom(creationContent); - await ctx.Room.SendMessageEventAsync(new MessageBuilder().WithMention($"#{ctx.Args[0]}:{ctx.Homeserver.ServerName}").Build()); + if (ctx.Homeserver is not AuthenticatedHomeserverSynapse synapse) return; + var res = await synapse.Admin.DeleteRoom(ctx.Args[0], new() { + Purge = true + }, waitForCompletion: false); } } \ No newline at end of file -- cgit 1.5.1