Skip to content

Commit 2667dbd

Browse files
authored
Add timestamped VOD link to HTML chat messages (#1538)
1 parent dd874bd commit 2667dbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

TwitchDownloaderCore/Chat/ChatHtml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public static async Task SerializeAsync(Stream outputStream, string filePath, Ch
6868
{
6969
var relativeTime = TimeSpan.FromSeconds(comment.content_offset_seconds);
7070
var timestamp = TimeSpanHFormat.ReusableInstance.Format(@"H\:mm\:ss", relativeTime);
71-
await sw.WriteLineAsync($"<pre class=\"comment-root\">[{timestamp}] {GetChatBadgesHtml(embedData, chatBadgeData, comment)}<a href=\"https://twitch.tv/{comment.commenter.name}\"><span class=\"comment-author\" {(comment.message.user_color == null ? "" : $"style=\"color: {comment.message.user_color}\"")}>{(comment.commenter.display_name.Any(x => x > 127) ? $"{comment.commenter.display_name} ({comment.commenter.name})" : comment.commenter.display_name)}</span></a><span class=\"comment-message\">: {GetMessageHtml(embedData, thirdEmoteData, chatRoot, comment)}</span></pre>");
71+
var timeCode = TimeSpanHFormat.ReusableInstance.Format(@"H\hmm\mss\s", relativeTime);
72+
await sw.WriteLineAsync($"<pre class=\"comment-root\">[<a href=\"https://twitch.tv/videos/{chatRoot.video.id}/?t={timeCode}\">{timestamp}</a>] {GetChatBadgesHtml(embedData, chatBadgeData, comment)}<a href=\"https://twitch.tv/{comment.commenter.name}\"><span class=\"comment-author\" {(comment.message.user_color == null ? "" : $"style=\"color: {comment.message.user_color}\"")}>{(comment.commenter.display_name.Any(x => x > 127) ? $"{comment.commenter.display_name} ({comment.commenter.name})" : comment.commenter.display_name)}</span></a><span class=\"comment-message\">: {GetMessageHtml(embedData, thirdEmoteData, chatRoot, comment)}</span></pre>");
7273
}
7374
break;
7475
default:

0 commit comments

Comments
 (0)