Skip to content

Commit

Permalink
[Bot] Add some debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Sep 7, 2024
1 parent 3dacdb6 commit 2f9df6d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Bot/Discord/Dc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ private static Task Log(LogMessage msg)
return Task.CompletedTask;
}

private static uint readyCount;

Check warning on line 39 in Bot/Discord/Dc.cs

View workflow job for this annotation

GitHub Actions / inspect

"[InconsistentNaming] Name 'readyCount' does not match rule 'static_fields_should_have_prefix'. Suggested name is 's_readyCount'." on /home/runner/work/Hyperstellar/Hyperstellar/Bot/Discord/Dc.cs(39,1412)

Check warning on line 39 in Bot/Discord/Dc.cs

View workflow job for this annotation

GitHub Actions / inspect

"[IDE1006] Naming rule violation: Missing prefix: 's_'" on /home/runner/work/Hyperstellar/Hyperstellar/Bot/Discord/Dc.cs(39,1412)

Check warning on line 39 in Bot/Discord/Dc.cs

View workflow job for this annotation

GitHub Actions / build

Naming rule violation: Missing prefix: 's_' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)
private static async Task Ready()
{
readyCount++;
s_botLog = (SocketTextChannel)s_bot.GetChannel(Secrets.s_botLogId);
await s_botLog.SendMessageAsync($"Ready {readyCount}");
_ = Task.Run(EventBotReady);
await s_interactionSvc.RegisterCommandsGloballyAsync();
}
Expand Down Expand Up @@ -123,7 +126,21 @@ internal static async Task ExceptionAsync(Exception ex)
Name = exName
};
}
await s_botLog.SendMessageAsync(s_botApp.Owner.Mention, embed: emb.Build());

// Always waits until the exception is actually sent
while (true)
{
try
{
await s_botLog.SendMessageAsync(s_botApp.Owner.Mention, embed: emb.Build());
return;
}
catch (Exception)
{
// ignored
}
}

}

internal static async Task SendLogAsync(string msg) => await s_botLog.SendMessageAsync(msg);
Expand Down

0 comments on commit 2f9df6d

Please sign in to comment.