This commit is contained in:
2026-03-11 01:23:41 +00:00
parent 8fde4a49fe
commit 8ed587aa59
2 changed files with 26 additions and 0 deletions

View File

@@ -88,6 +88,8 @@ namespace Reactor.Services
}
};
//Bot is active and ready
Console.WriteLine("Bot ready and listening...");
}

View File

@@ -1,4 +1,5 @@
using Valour.Sdk.Client;
using Valour.Sdk.ModelLogic;
using Valour.Sdk.Models;
using Valour.Shared.Models;
@@ -21,6 +22,7 @@ namespace Reactor.Services
await planet.EnsureReadyAsync();
await planet.FetchInitialDataAsync();
foreach (var channel in planet.Channels)
{
channelCache[channel.Id] = channel;
@@ -32,6 +34,28 @@ namespace Reactor.Services
}
}
Action<IModelEvent<Channel>> channelChangedHandler = (evt) =>
{
_ = Task.Run(async () =>
{
foreach (var channel in planet.Channels)
{
if (channelCache.ContainsKey(channel.Id))
continue;
channelCache[channel.Id] = channel;
if (channel.ChannelType == ChannelTypeEnum.PlanetChat)
{
await channel.OpenWithResult("Reactor");
Console.WriteLine($"New channel detected: {planet.Name} -> {channel.Name}");
}
}
});
};
planet.Channels.Changed += channelChangedHandler;
initializedPlanets.Add(planet.Id);
}
}