mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 18:58:27 -04:00
- NadekoBot class renamed to Bot
- Implemented grpc based coordinator. Supports restarting, killing single or all shards, as well as getting current shard statuses. (Adaptation of the one used by the public bot) - Coord is setup via coord.yml file - Methods from SelfService which deal with shard/bot restart etc have been moved to ICoordinator (with GrpcRemoteCoordinator being the default implementation atm) - Vastly simplified NadekoBot/Program.cs
This commit is contained in:
@@ -1,34 +1,14 @@
|
||||
using NadekoBot.Core.Services;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot;
|
||||
using NadekoBot.Core.Services;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
public sealed class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var pid = Process.GetCurrentProcess().Id;
|
||||
System.Console.WriteLine($"Pid: {pid}");
|
||||
if (args.Length == 2
|
||||
&& int.TryParse(args[0], out int shardId)
|
||||
&& int.TryParse(args[1], out int parentProcessId))
|
||||
{
|
||||
await new NadekoBot(shardId, parentProcessId == 0 ? pid : parentProcessId)
|
||||
.RunAndBlockAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await new ShardsCoordinator()
|
||||
.RunAsync()
|
||||
.ConfigureAwait(false);
|
||||
#if DEBUG
|
||||
await new NadekoBot(0, pid)
|
||||
.RunAndBlockAsync();
|
||||
#else
|
||||
await Task.Delay(-1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var pid = System.Environment.ProcessId;
|
||||
|
||||
var shardId = 0;
|
||||
if (args.Length == 1)
|
||||
int.TryParse(args[0], out shardId);
|
||||
|
||||
LogSetup.SetupLogger(shardId);
|
||||
Log.Information($"Pid: {pid}");
|
||||
|
||||
await new Bot(shardId).RunAndBlockAsync();
|
Reference in New Issue
Block a user