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

namespace MiniUtils.Commands;

public class OpsCommand(IgnoreListManager ignoreListManager) : ICommand {
    public string Name => "ops";

    public string[]? Aliases => ["admins", "mods"];

    public string Description => "Ping all the mods";

    public bool Unlisted => true;

    public async Task Invoke(CommandContext ctx) {
        var pls = await ctx.Room.GetPowerLevelsAsync();
        var msb = new MessageBuilder();
        foreach (var pl in pls.Users.Where(x => x.Value >= pls.Kick)) {
            msb = msb.WithMention(pl.Key).WithBody(" ");
        }

        await ctx.Room.SendMessageEventAsync(msb.Build());
    }
}