about summary refs log tree commit diff
path: root/MiniUtils/Commands/DeleteRoomCommand.cs
blob: 8d02dfbc8d2e2e83703570d92af0fa33a7b452e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using LibMatrix.Homeservers;
using LibMatrix.Utilities.Bot.Interfaces;

namespace MiniUtils.Commands;

public class DeleteRoomCommand() : ICommand {
    public string Name => "delete room";

    public string[]? Aliases => ["deleteroom"];

    public string Description => "Delete a room";

    public bool Unlisted => false;

    public async Task Invoke(CommandContext ctx) {
        if (ctx.Homeserver is not AuthenticatedHomeserverSynapse synapse) return;
        var res = await synapse.Admin.DeleteRoom(ctx.Args[0], new() {
            Purge = true
        }, waitForCompletion: false);
    }
}