diff --git a/MiniUtils/Commands/SpamCommand.cs b/MiniUtils/Commands/SpamCommand.cs
index 742ae3b..01f7244 100644
--- a/MiniUtils/Commands/SpamCommand.cs
+++ b/MiniUtils/Commands/SpamCommand.cs
@@ -1,3 +1,8 @@
+using System.Net.Http.Json;
+using LibMatrix;
+using LibMatrix.EventTypes.Spec.State.Policy;
+using LibMatrix.EventTypes.Spec.State.RoomInfo;
+using LibMatrix.Extensions;
using LibMatrix.Helpers;
using LibMatrix.RoomTypes;
using LibMatrix.Utilities.Bot.Interfaces;
@@ -16,11 +21,62 @@ public class SpamCommand(IgnoreListManager ignoreListManager) : ICommand {
public bool Unlisted => true;
public async Task Invoke(CommandContext ctx) {
- var tasks = Enumerable.Range(0, 10000)
- .Select(i => SendMessage(ctx.Room, i.ToString()))
- .ToList();
- await Task.WhenAll(tasks);
- await ctx.Room.SendMessageEventAsync(new MessageBuilder().WithBody($"{Emojis.Recycle}").Build());
+ // var tasks = Enumerable.Range(0, 10000)
+ // .Select(i => SendMessage(ctx.Room, i.ToString()))
+ // .ToList();
+ // await Task.WhenAll(tasks);
+ // await ctx.Room.SendMessageEventAsync(new MessageBuilder().WithBody($"{Emojis.Recycle}").Build());
+ //
+ for (int i = 0; i < 8; i++) {
+ // _ = ctx.Homeserver.ClientHttpClient.PostAsJsonAsync($"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{ctx.Room.RoomId}/bulk_send_events",
+ // CreateMessagesAsync());
+
+ // await new MatrixHttpClient(){BaseAddress = new("http://127.0.0.1:8888")}.GetAsync($"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{ctx.Room.RoomId}/bulk_send_events");
+ _ = ctx.Homeserver.ClientHttpClient
+ // _ = new MatrixHttpClient(){BaseAddress = new("http://127.0.0.1:8888")}
+ .PostAsyncEnumerableAsJsonAsync($"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{ctx.Room.RoomId}/bulk_send_events?_r={Guid.NewGuid()}",
+ CreateMessagesAsync(ctx.Room));
+ }
+ }
+
+ private async IAsyncEnumerable<StateEvent> CreateMessagesAsync(GenericRoom room) {
+ int i = 0;
+ // var pls = await room.GetStateEventAsync(RoomPowerLevelEventContent.EventId);
+ // var pls2 = await room.GetStateEventAsync(RoomPowerLevelEventContent.EventId);
+ // if (pls2.TypedContent is RoomPowerLevelEventContent pl2) {
+ // pl2.Ban = 5;
+ // pl2.Users!["@emma:synapse.localhost"] = 102;
+ // pls2.TypedContent = pl2;
+ // }
+ //
+ // yield return new() {
+ // RawContent = pls2.RawContent,
+ // Type = RoomPowerLevelEventContent.EventId,
+ // StateKey = ""
+ // // StateKey = Guid.NewGuid().ToString()
+ // };
+ while (i++ < 200) {
+ // await Task.Delay(500);
+ Console.WriteLine(i);
+ // yield return new() {
+ // Type = "m.room.message",
+ // TypedContent = new MessageBuilder().WithBody(i.ToString()).Build()
+ // };
+
+ // yield return new() {
+ // RawContent = pls.RawContent,
+ // Type = RoomPowerLevelEventContent.EventId,
+ // StateKey = ""
+ // // StateKey = Guid.NewGuid().ToString()
+ // };
+ yield return new() {
+ TypedContent = new UserPolicyRuleEventContent() {
+ Entity = $"@{Guid.NewGuid()}:{room.Homeserver.ServerName}",
+ },
+ Type = UserPolicyRuleEventContent.EventId,
+ StateKey = Guid.NewGuid().ToString()
+ };
+ }
}
private async Task SendMessage(GenericRoom room, string content) {
|