yes
This commit is contained in:
@@ -88,6 +88,8 @@ namespace Reactor.Services
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//Bot is active and ready
|
||||
Console.WriteLine("Bot ready and listening...");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Valour.Sdk.Client;
|
||||
using Valour.Sdk.ModelLogic;
|
||||
using Valour.Sdk.Models;
|
||||
using Valour.Shared.Models;
|
||||
|
||||
@@ -20,6 +21,7 @@ namespace Reactor.Services
|
||||
|
||||
await planet.EnsureReadyAsync();
|
||||
await planet.FetchInitialDataAsync();
|
||||
|
||||
|
||||
foreach (var channel in planet.Channels)
|
||||
{
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user