about summary refs log tree commit diff
path: root/Utilities/LibMatrix.DevTestBot/Bot/Commands
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-02-18 07:40:41 +0100
committerRory& <root@rory.gay>2025-02-18 07:40:41 +0100
commit8673cb236f427ba6af6382e3b5702a134f1afe2e (patch)
tree91cf9a092c47e4041d2e70fe01582184ebc90897 /Utilities/LibMatrix.DevTestBot/Bot/Commands
parentChange defaults of GetManyMessages (diff)
downloadLibMatrix-8673cb236f427ba6af6382e3b5702a134f1afe2e.tar.xz
MxcUri class, other various work
Diffstat (limited to '')
-rw-r--r--Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs b/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs

index 85c86a3..745c75d 100644 --- a/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs +++ b/Utilities/LibMatrix.DevTestBot/Bot/Commands/PingCommand.cs
@@ -7,5 +7,16 @@ public class PingCommand : ICommand { public string Name { get; } = "ping"; public string Description { get; } = "Pong!"; - public async Task Invoke(CommandContext ctx) => await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!")); + // public async Task Invoke(CommandContext ctx) => await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!")); + public async Task Invoke(CommandContext ctx) { + // await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "pong!")); + var count = ctx.Args.Length > 0 ? int.Parse(ctx.Args[0]) : 1; + var tasks = Enumerable.Range(0, count).Select(async i => { + await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: $"!ping {i}", messageType: "m.text")); + await Task.Delay(1000); + }).ToList(); + await Task.WhenAll(tasks); + + await ctx.Room.SendMessageEventAsync(new RoomMessageEventContent(body: "Pong!")); + } } \ No newline at end of file