mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 10:48:26 -04:00
- Bot now takes shard id (optional) and total shards (optional) command line arguments (changed from shard id and parent process id)
- Sharding with coordinator now works properly - Documented creds.yml RestartCommand - it has no effect when coordinator is starting the bot - Regenerated creds_example.yml - Removed all db migrators as the v3 requires the user to have updated 2.x all the way - TotalShards in creds.yml gets overriden by coord.yml's TotalShards if the bot is ran through coordinator (more precisely, by the command line argument to the bot) - Coordinator now runs on http://localhost:3442 by default, you can change this in appsettings.json - This is done because of macos https issues - Primarily because https for regular users is a massive hassle. Coordinator shouldn't be exposed anyway - Minor cleanup
This commit is contained in:
@@ -1,14 +1,35 @@
|
||||
using NadekoBot;
|
||||
using System;
|
||||
using NadekoBot;
|
||||
using NadekoBot.Services;
|
||||
using Serilog;
|
||||
|
||||
var pid = System.Environment.ProcessId;
|
||||
|
||||
var shardId = 0;
|
||||
if (args.Length == 1)
|
||||
int.TryParse(args[0], out shardId);
|
||||
int? totalShards = null; // 0 to read from creds.yml
|
||||
if (args.Length > 0)
|
||||
{
|
||||
if (!int.TryParse(args[0], out shardId))
|
||||
{
|
||||
Console.Error.WriteLine("Invalid first argument (shard id)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length > 1)
|
||||
{
|
||||
if (!int.TryParse(args[1], out var shardCount))
|
||||
{
|
||||
Console.Error.WriteLine("Invalid second argument (total shards)");
|
||||
return;
|
||||
}
|
||||
|
||||
totalShards = shardCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
LogSetup.SetupLogger(shardId);
|
||||
Log.Information($"Pid: {pid}");
|
||||
|
||||
await new Bot(shardId).RunAndBlockAsync();
|
||||
await new Bot(shardId, totalShards).RunAndBlockAsync();
|
Reference in New Issue
Block a user