- Added MissingMethodException to common errors
- Added jump to message feature to log analysis - Fixed notes not being allowed to be longer than 256 characters.
This commit is contained in:
parent
7f08d72ef8
commit
c931718ce5
6 changed files with 44 additions and 30 deletions
|
|
@ -24,7 +24,7 @@ namespace SMSModLogOutputAnalyzer.Data
|
|||
}
|
||||
public static void Save()
|
||||
{
|
||||
SerializerXML.SerializeToFile(Instance, "Config.xml");
|
||||
try { SerializerXML.SerializeToFile(Instance, "Config.xml"); } catch (Exception e) { Console.WriteLine(e); }
|
||||
}
|
||||
public static Config Instance { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace SMSModLogOutputAnalyzer.Data
|
|||
{
|
||||
var unix = ((DateTimeOffset)CreationTime).ToUnixTimeSeconds();
|
||||
// "Note " + Id, "`" + Text + "`\nCreated by <@" + CreatorID + "> at <t:" + unix + ":f>"
|
||||
return new EmbedFieldBuilder().WithName(Text).WithValue("ID: `" + Id + "`\nCreated by <@" + CreatorID + "> at <t:" + unix + ":f>");
|
||||
return new EmbedFieldBuilder().WithName("\u200b").WithValue("**"+Text+"**\nID: `" + Id + "`\nCreated by <@" + CreatorID + "> at <t:" + unix + ":f>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace SMSModLogOutputAnalyzer.Data
|
|||
|
||||
public void Save()
|
||||
{
|
||||
SerializerXML.SerializeToFile(this, "NotesData.xml");
|
||||
try { SerializerXML.SerializeToFile(this, "NotesData.xml"); } catch (Exception e) { Console.WriteLine(e); }
|
||||
}
|
||||
public static NotesDataObject Load()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace SMSModLogOutputAnalyzer.Data
|
|||
{
|
||||
public void Save()
|
||||
{
|
||||
SerializerXML.SerializeToFile(this, "RoleButtons.xml");
|
||||
try { SerializerXML.SerializeToFile(this, "RoleButtons.xml"); } catch (Exception e) { Console.WriteLine(e); }
|
||||
}
|
||||
public static RoleButtonsDataObject Load()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace SMSModLogOutputAnalyzer.Modules
|
|||
{
|
||||
if(message.Attachments.Count > 0)
|
||||
{
|
||||
await Upload((Attachment)message.Attachments.First());
|
||||
await Analyze((Attachment)message.Attachments.First(), message);
|
||||
} else
|
||||
{
|
||||
await RespondAsync(embed: new EmbedBuilder().WithDescription("Message has no attachment.").WithDefaults().Build(), ephemeral: true);
|
||||
|
|
@ -48,6 +48,10 @@ namespace SMSModLogOutputAnalyzer.Modules
|
|||
}
|
||||
[SlashCommand("upload", "Upload a LogOutput.log file for analysis.")]
|
||||
public async Task Upload([Summary(description: "Please upload your LogOutput.log file. It is found inside the BepInEx folder in your game directory.")] Attachment file)
|
||||
{
|
||||
await Analyze(file);
|
||||
}
|
||||
public async Task Analyze(Attachment file, IMessage logmessage = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -73,10 +77,13 @@ namespace SMSModLogOutputAnalyzer.Modules
|
|||
"[Info : BepInEx] Loading [",
|
||||
"[Message:MelonLoader] Assembly: ",
|
||||
"[Info : Unity Log] System.EntryPointNotFoundException: SteamAPI_SteamInput_v001",
|
||||
"[Message: File Tree] ");
|
||||
"[Message: File Tree] ",
|
||||
"[Error : Unity Log] MissingMethodException");
|
||||
|
||||
Log("Initial analysis complete.");
|
||||
|
||||
if(logmessage != null) values[":envelope_with_arrow: Jump to Message"] = new List<string> { logmessage.GetJumpUrl() };
|
||||
|
||||
values[":page_facing_up: Game Version"] = new List<string> { lines["[Message:MelonLoader] Game Version: "][0].Line };
|
||||
values[":diamond_shape_with_a_dot_inside: Unity Version"] = new List<string> { lines["[Message:MelonLoader] Unity Version: "][0].Line };
|
||||
values[":tools: BepInEx Version"] = new List<string> { lines["[Message: BepInEx] BepInEx "][0].Line.Split(" - ")[0] };
|
||||
|
|
@ -100,6 +107,7 @@ namespace SMSModLogOutputAnalyzer.Modules
|
|||
part = new();
|
||||
|
||||
if (lines["[Info : Unity Log] System.EntryPointNotFoundException: SteamAPI_SteamInput_v001"].Count > 0) part.Add(":x: Steam Entry Point not found");
|
||||
if (lines["[Error : Unity Log] MissingMethodException"].Count > 0) part.Add(":x: MissingMethodException" + lines["[Error : Unity Log] MissingMethodException"][0].Line);
|
||||
|
||||
values[":loudspeaker: Common Errors"] = part;
|
||||
part = new();
|
||||
|
|
|
|||
|
|
@ -13,34 +13,40 @@ namespace SMSModLogOutputAnalyzer.Modules
|
|||
[RequireUserPermission(GuildPermission.ManageRoles)]
|
||||
public async Task View(IUser user, [Summary(description: "How many notes to skip (used for pagination)")] int offset = 0)
|
||||
{
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
||||
var notes = Data[user].Notes.Skip(offset).Take(25).ToArray();
|
||||
bool addNextPageButton = Data[user].Notes.Count > offset + 25;
|
||||
if (notes.Length == 0)
|
||||
try
|
||||
{
|
||||
await RespondAsync(embed: new EmbedBuilder().WithDefaults().WithDescription("No " + (offset > 0 ? "more " : "") + "notes have been added to this user.").Build(), ephemeral: true);
|
||||
return;
|
||||
}
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
||||
embedBuilder.WithAuthor(user);
|
||||
embedBuilder.WithDefaults();
|
||||
var notes = Data[user].Notes.Skip(offset).Take(25).ToArray();
|
||||
bool addNextPageButton = Data[user].Notes.Count > offset + 25;
|
||||
if (notes.Length == 0)
|
||||
{
|
||||
await RespondAsync(embed: new EmbedBuilder().WithDefaults().WithDescription("No " + (offset > 0 ? "more " : "") + "notes have been added to this user.").Build(), ephemeral: true);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var note in notes)
|
||||
embedBuilder.WithAuthor(user);
|
||||
embedBuilder.WithDefaults();
|
||||
|
||||
foreach (var note in notes)
|
||||
{
|
||||
embedBuilder.AddField(note.ToField());
|
||||
}
|
||||
|
||||
var embed = embedBuilder.Build();
|
||||
var button = new ComponentBuilder().WithButton("Next Page", "view_notes:" + user.Id + ":" + (offset + 25)).Build();
|
||||
|
||||
if (addNextPageButton)
|
||||
{
|
||||
await RespondAsync(embed: embed, components: button, ephemeral: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RespondAsync(embed: embed, ephemeral: true);
|
||||
}
|
||||
} catch(Exception e)
|
||||
{
|
||||
embedBuilder.AddField(note.ToField());
|
||||
}
|
||||
|
||||
var embed = embedBuilder.Build();
|
||||
var button = new ComponentBuilder().WithButton("Next Page", "view_notes:" + user.Id + ":" + (offset + 25)).Build();
|
||||
|
||||
if (addNextPageButton)
|
||||
{
|
||||
await RespondAsync(embed: embed, components: button, ephemeral: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RespondAsync(embed: embed, ephemeral: true);
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
[SlashCommand("add", "Add a note to a user.")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue