Updated default restart commands to assume that the bot is built as a binary

This commit is contained in:
Toastie 2025-03-12 11:31:22 +13:00
parent d5d3801e1a
commit fb658b8189
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
4 changed files with 15 additions and 13 deletions
src/EllieBot

View file

@ -34,7 +34,7 @@ public class CryptoService : IEService
var gElement = xml["svg"]?["g"]; var gElement = xml["svg"]?["g"];
if (gElement is null) if (gElement is null)
return Array.Empty<PointF>(); return [];
Span<PointF> points = new PointF[gElement.ChildNodes.Count]; Span<PointF> points = new PointF[gElement.ChildNodes.Count];
var cnt = 0; var cnt = 0;
@ -73,7 +73,7 @@ public class CryptoService : IEService
} }
if (cnt == 0) if (cnt == 0)
return Array.Empty<PointF>(); return [];
return points.Slice(0, cnt).ToArray(); return points.Slice(0, cnt).ToArray();
} }

View file

@ -6,7 +6,7 @@ namespace EllieBot.Common;
public sealed class Creds : IBotCreds public sealed class Creds : IBotCreds
{ {
[Comment("""DO NOT CHANGE""")] [Comment("""DO NOT CHANGE""")]
public int Version { get; set; } = 13; public int Version { get; set; } = 20;
[Comment("""Bot token. Do not share with anyone ever -> https://discordapp.com/developers/applications/""")] [Comment("""Bot token. Do not share with anyone ever -> https://discordapp.com/developers/applications/""")]
public string Token { get; set; } public string Token { get; set; }
@ -148,8 +148,8 @@ public sealed class Creds : IBotCreds
{0} -> shard id {0} -> shard id
{1} -> total shards {1} -> total shards
Linux default Linux default
cmd: dotnet cmd: EllieBot
args: "EllieBot.dll -- {0}" args: "{0}"
Windows default Windows default
cmd: EllieBot.exe cmd: EllieBot.exe
args: "{0}" args: "{0}"

View file

@ -77,7 +77,8 @@ public sealed class BotCredsProvider : IBotCredsProvider
if (string.IsNullOrWhiteSpace(_creds.Token)) if (string.IsNullOrWhiteSpace(_creds.Token))
{ {
Log.Error("Token is missing from data/creds.yml or Environment variables.\nAdd it and restart the program"); Log.Error(
"Token is missing from data/creds.yml or Environment variables.\nAdd it and restart the program");
Helpers.ReadErrorAndExit(1); Helpers.ReadErrorAndExit(1);
return; return;
} }
@ -85,17 +86,18 @@ public sealed class BotCredsProvider : IBotCredsProvider
if (string.IsNullOrWhiteSpace(_creds.RestartCommand?.Cmd) if (string.IsNullOrWhiteSpace(_creds.RestartCommand?.Cmd)
|| string.IsNullOrWhiteSpace(_creds.RestartCommand?.Args)) || string.IsNullOrWhiteSpace(_creds.RestartCommand?.Args))
{ {
if (Environment.OSVersion.Platform == PlatformID.Unix) if (Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX)
{ {
_creds.RestartCommand = new RestartConfig() _creds.RestartCommand = new()
{ {
Args = "dotnet", Args = "EllieBot",
Cmd = "EllieBot.dll -- {0}" Cmd = "{0}"
}; };
} }
else else
{ {
_creds.RestartCommand = new RestartConfig() _creds.RestartCommand = new()
{ {
Args = "EllieBot.exe", Args = "EllieBot.exe",
Cmd = "{0}" Cmd = "{0}"

View file

@ -111,8 +111,8 @@ twitchClientSecret:
# {0} -> shard id # {0} -> shard id
# {1} -> total shards # {1} -> total shards
# Linux default # Linux default
# cmd: dotnet # cmd: EllieBot
# args: "EllieBot.dll -- {0}" # args: "{0}"
# Windows default # Windows default
# cmd: EllieBot.exe # cmd: EllieBot.exe
# args: "{0}" # args: "{0}"