From af6d1c7e11b2e9b4108ae8b693650b2a18cd2001 Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 30 Oct 2025 02:49:12 +0100 Subject: Old work --- ModerationBot/Commands/DbgAniRainbowTest.cs | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ModerationBot/Commands/DbgAniRainbowTest.cs (limited to 'ModerationBot/Commands/DbgAniRainbowTest.cs') diff --git a/ModerationBot/Commands/DbgAniRainbowTest.cs b/ModerationBot/Commands/DbgAniRainbowTest.cs new file mode 100644 index 0000000..eed6fa5 --- /dev/null +++ b/ModerationBot/Commands/DbgAniRainbowTest.cs @@ -0,0 +1,50 @@ +using System.Diagnostics; +using LibMatrix.EventTypes.Spec; +using LibMatrix.Helpers; +using LibMatrix.RoomTypes; +using LibMatrix.Services; +using LibMatrix.Utilities.Bot.Interfaces; +using ModerationBot.AccountData; + +namespace ModerationBot.Commands; + +public class DbgAniRainbowTest(IServiceProvider services, HomeserverProviderService hsProvider, HomeserverResolverService hsResolver, PolicyEngine engine) : ICommand { + public string Name { get; } = "dbg-ani-rainbow"; + public string[]? Aliases { get; } + public string Description { get; } = "[Debug] animated rainbow :)"; + public bool Unlisted { get; } + private GenericRoom logRoom { get; set; } + + public async Task CanInvoke(CommandContext ctx) { + return ctx.Room.RoomId == "!DoHEdFablOLjddKWIp:rory.gay"; + } + + public async Task Invoke(CommandContext ctx) { + //255 long string + // var rainbow = "🟥🟧🟨🟩🟦🟪"; + var rainbow = "M"; + var chars = rainbow; + for (var i = 0; i < 76; i++) { + chars += rainbow[i%rainbow.Length]; + } + + var msg = new MessageBuilder(msgType: "m.notice").WithRainbowString(chars).Build(); + var msgEvent = await ctx.Room.SendMessageEventAsync(msg); + + Task.Run(async () => { + + int i = 0; + while (true) { + msg = new MessageBuilder(msgType: "m.notice").WithRainbowString(chars, offset: i+=5).Build(); + // .SetReplaceRelation(msgEvent.EventId); + // msg.Body = ""; + // msg.FormattedBody = ""; + var sw = Stopwatch.StartNew(); + await ctx.Room.SendMessageEventAsync(msg); + await Task.Delay(sw.Elapsed); + } + + }); + + } +} \ No newline at end of file -- cgit 1.5.1