From 8d97fc1197ecdb05288449c4e2b9b5a311c45746 Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Sun, 20 Oct 2024 19:48:53 -0400 Subject: [PATCH] Move startup msg from ready event to startup --- Events/ReadyEvent.cs | 3 --- Helpers/DebugInfoHelpers.cs | 10 +++++----- Program.cs | 3 +++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Events/ReadyEvent.cs b/Events/ReadyEvent.cs index 33cb1ca..9e44161 100644 --- a/Events/ReadyEvent.cs +++ b/Events/ReadyEvent.cs @@ -7,9 +7,6 @@ public static async Task OnReady(DiscordClient client, SessionCreatedEventArgs e await Task.Run(async () => { Program.ConnectTime = DateTime.Now; - - await Program.HomeChannel.SendMessageAsync(await DebugInfoHelpers.GenerateDebugInfoEmbed(true)); - await ActivityTasks.SetActivityAsync(); }); } diff --git a/Helpers/DebugInfoHelpers.cs b/Helpers/DebugInfoHelpers.cs index 2f78f60..c5105a3 100644 --- a/Helpers/DebugInfoHelpers.cs +++ b/Helpers/DebugInfoHelpers.cs @@ -41,7 +41,7 @@ public static DebugInfo GetDebugInfo() } // If provided a DebugInfo object, use that... - private static Task GenerateDebugInfoEmbed(DebugInfo debugInfo, bool isOnReadyEvent) + private static Task GenerateDebugInfoEmbed(DebugInfo debugInfo, bool isOnStartup) { // Check whether GuildDownloadCompleted has been fired yet // If not, wait until it has @@ -50,7 +50,7 @@ private static Task GenerateDebugInfoEmbed(DebugInfo debugInfo, bo DiscordEmbedBuilder embed = new() { - Title = isOnReadyEvent ? "Connected!" : "", + Title = isOnStartup ? "Connected!" : "", Color = Program.BotColor }; @@ -64,7 +64,7 @@ private static Task GenerateDebugInfoEmbed(DebugInfo debugInfo, bo embed.AddField("Library", debugInfo.Library, true); embed.AddField("Server Count", Program.Discord.Guilds.Count.ToString(), true); embed.AddField("Command Count", Program.ApplicationCommands.Count.ToString(), true); - if (isOnReadyEvent) embed.AddField("Time Since Process Start", debugInfo.TimeSinceProcessStart, true); + if (isOnStartup) embed.AddField("Time Since Process Start", debugInfo.TimeSinceProcessStart, true); embed.AddField("Commit Hash", commitHash, true); embed.AddField(debugInfo.CommitTimeDescription, debugInfo.CommitTimestamp, true); embed.AddField("Commit Message", debugInfo.CommitMessage); @@ -73,9 +73,9 @@ private static Task GenerateDebugInfoEmbed(DebugInfo debugInfo, bo } // ...otherwise, get debug info manually - public static async Task GenerateDebugInfoEmbed(bool isOnReadyEvent) + public static async Task GenerateDebugInfoEmbed(bool isOnStartup) { - return await GenerateDebugInfoEmbed(GetDebugInfo(), isOnReadyEvent); + return await GenerateDebugInfoEmbed(GetDebugInfo(), isOnStartup); } diff --git a/Program.cs b/Program.cs index 9fb25be..8ad168c 100644 --- a/Program.cs +++ b/Program.cs @@ -282,6 +282,9 @@ internal static async Task Main() #if !DEBUG await EvalCommands.RunCommand("cat /app/id_ed25519 > ~/.ssh/id_ed25519 && chmod 700 ~/.ssh/id_ed25519"); #endif + + // Send startup message + await Program.HomeChannel.SendMessageAsync(await DebugInfoHelpers.GenerateDebugInfoEmbed(true)); // Run tasks