Skip to content

Commit

Permalink
Improved time created
Browse files Browse the repository at this point in the history
  • Loading branch information
Loudbooks committed Sep 8, 2024
1 parent 549573a commit 70a2fac
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions loginspect/LogInspect/LogInspect/Modules/LogCommandModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ namespace LogInspect.Modules;

[CommandContextType(InteractionContextType.BotDm, InteractionContextType.PrivateChannel, InteractionContextType.Guild)]
[IntegrationType(ApplicationIntegrationType.UserInstall)]
// ReSharper disable once UnusedType.Global
public partial class LogCommandModule : InteractionModuleBase<SocketInteractionContext>
{
private static readonly Dictionary<ulong, Paginator> PageMap = new();
private static readonly McLogInspector McLogInspector = new();

public LogCommandModule()
{
}


[SlashCommand("mclog", "Inspect a Minecraft log file")]
public async Task LatestAsync(string link, bool ephemeral = true)
{
Expand Down Expand Up @@ -139,12 +136,7 @@ private string GeneratePageOne(string[] lines, int stacktraceAmount)
{
minecraftVersion = versionLines[0].Split("]").Last().Split(": ").Last();

var timeCreatedMatch = LatestLogTimeCreatedRegex().Match(lines[0]);

if (timeCreatedMatch.Success)
{
timeCreated = timeCreatedMatch.Value;
}
timeCreated = lines[0].Split("]").First().Replace("[", "").Trim();
}
else
{
Expand Down Expand Up @@ -213,7 +205,4 @@ private string GeneratePageOne(string[] lines, int stacktraceAmount)

return string.Join("\n", newLines);
}

[GeneratedRegex(@"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}")]
private static partial Regex LatestLogTimeCreatedRegex();
}

0 comments on commit 70a2fac

Please sign in to comment.