diff --git a/Clients/CompatApiClient/CompatApiClient.csproj b/Clients/CompatApiClient/CompatApiClient.csproj index 1ae6bc0a..62a25937 100644 --- a/Clients/CompatApiClient/CompatApiClient.csproj +++ b/Clients/CompatApiClient/CompatApiClient.csproj @@ -14,9 +14,9 @@ - + - + diff --git a/Clients/IrdLibraryClient/IrdLibraryClient.csproj b/Clients/IrdLibraryClient/IrdLibraryClient.csproj index b0f8b1d2..a772ad8a 100644 --- a/Clients/IrdLibraryClient/IrdLibraryClient.csproj +++ b/Clients/IrdLibraryClient/IrdLibraryClient.csproj @@ -8,7 +8,7 @@ - + diff --git a/Clients/PsnClient/PsnClient.csproj b/Clients/PsnClient/PsnClient.csproj index 0e2577ad..6ca285c1 100644 --- a/Clients/PsnClient/PsnClient.csproj +++ b/Clients/PsnClient/PsnClient.csproj @@ -15,7 +15,7 @@ - + diff --git a/CompatBot/Commands/Sudo.Bot.cs b/CompatBot/Commands/Sudo.Bot.cs index 6c0af4a7..738fd98f 100644 --- a/CompatBot/Commands/Sudo.Bot.cs +++ b/CompatBot/Commands/Sudo.Bot.cs @@ -63,7 +63,7 @@ namespace CompatBot.Commands return; msg = await ctx.RespondAsync("Restarting...").ConfigureAwait(false); - Restart(ctx.Channel.Id); + Restart(ctx.Channel.Id, "Restarted after successful bot update"); } catch (Exception e) { @@ -90,7 +90,7 @@ namespace CompatBot.Commands msg = await ctx.RespondAsync("Saving state...").ConfigureAwait(false); await StatsStorage.SaveAsync(true).ConfigureAwait(false); msg = await msg.UpdateOrCreateMessageAsync(ctx.Channel, "Restarting...").ConfigureAwait(false); - Restart(ctx.Channel.Id); + Restart(ctx.Channel.Id, "Restarted due to command request"); } catch (Exception e) { @@ -178,7 +178,7 @@ namespace CompatBot.Commands return (true, stdout); } - internal static void Restart(ulong channelId) + internal static void Restart(ulong channelId, string restartMsg) { if (SandboxDetector.Detect() == SandboxType.Docker) { @@ -192,6 +192,14 @@ namespace CompatBot.Commands } else ch.Value = channelId.ToString(); + var msg = db.BotState.FirstOrDefault(k => k.Key == "bot-restart-msg"); + if (msg is null) + { + msg = new BotState {Key = "bot-restart-msg", Value = restartMsg}; + db.BotState.Add(msg); + } + else + msg.Value = restartMsg; db.SaveChanges(); } RestartNoSaving(channelId); diff --git a/CompatBot/CompatBot.csproj b/CompatBot/CompatBot.csproj index d67e95ec..5e3a49f4 100644 --- a/CompatBot/CompatBot.csproj +++ b/CompatBot/CompatBot.csproj @@ -24,11 +24,11 @@ - - - + + + - + @@ -44,14 +44,14 @@ - + - - + +