mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 08:34:27 -05:00 
			
		
		
		
	NEW: add NadekoBot__creds env to specify alternative creds.yml See merge request Kwoth/nadekobot!257
		
			
				
	
	
		
			30 lines
		
	
	
		
			778 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			778 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using Nadeko.Common;
 | 
						|
 | 
						|
var pid = Environment.ProcessId;
 | 
						|
 | 
						|
var shardId = 0;
 | 
						|
int? totalShards = null; // 0 to read from creds.yml
 | 
						|
if (args.Length > 0 && args[0] != "run")
 | 
						|
{
 | 
						|
    if (!int.TryParse(args[0], out shardId))
 | 
						|
    {
 | 
						|
        Console.Error.WriteLine("Invalid first argument (shard id): {0}", args[0]);
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    if (args.Length > 1)
 | 
						|
    {
 | 
						|
        if (!int.TryParse(args[1], out var shardCount))
 | 
						|
        {
 | 
						|
            Console.Error.WriteLine("Invalid second argument (total shards): {0}", args[1]);
 | 
						|
            return;
 | 
						|
        }
 | 
						|
 | 
						|
        totalShards = shardCount;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
LogSetup.SetupLogger(shardId);
 | 
						|
Log.Information("Pid: {ProcessId}", pid);
 | 
						|
 | 
						|
await new Bot(shardId, totalShards, Environment.GetEnvironmentVariable("NadekoBot__creds")).RunAndBlockAsync(); |