Skip to content

Commit

Permalink
Make highlighted message detection more forgiving (#1111)
Browse files Browse the repository at this point in the history
* Make highlighted message detection more forgiving

* Add more verbose logging
  • Loading branch information
ScrubN authored Jun 25, 2024
1 parent d25c1ca commit c8f2bd4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions TwitchDownloaderCore/ChatRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,24 @@ private CommentSection GenerateCommentSection(int commentIndex, int sectionDefau
{
if (comment.message.user_notice_params.msg_id is not "highlighted-message" and not "sub" and not "resub" and not "subgift" and not "")
{
_progress.LogVerbose($"{comment._id} has invalid {nameof(comment.message.user_notice_params)}: {comment.message.user_notice_params.msg_id}.");
return null;
}
if (comment.message.user_notice_params.msg_id == "highlighted-message" && comment.message.fragments == null && comment.message.body != null)

if (comment.message.user_notice_params.msg_id == "highlighted-message")
{
comment.message.fragments = new List<Fragment> { new Fragment() };
comment.message.fragments[0].text = comment.message.body;
if (comment.message.fragments == null && comment.message.body != null)
{
comment.message.fragments = new List<Fragment> { new() { text = comment.message.body } };
}

highlightType = HighlightType.ChannelPointHighlight;
}
}

if (comment.message.fragments == null || comment.commenter == null)
{
_progress.LogVerbose($"{comment._id} lacks fragments and/or a commenter.");
return null;
}

Expand Down

0 comments on commit c8f2bd4

Please sign in to comment.