Skip to content

Commit

Permalink
Merge WIP feature PR Tyrrrz#1170 (tmp)
Browse files Browse the repository at this point in the history
  • Loading branch information
nulldg committed Dec 10, 2023
2 parents e6c13b5 + 54dcf39 commit 897c99e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions DiscordChatExporter.Core/Exporting/ExportRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,23 @@ private static string FormatPath(
Channel channel,
Snowflake? after,
Snowflake? before
) =>
Regex.Replace(
)
{
var recursivePattern = Regex.Match(path, "%r(%.*)%r");
if (
channel.Parent?.Parent != null
&& recursivePattern.Success
&& recursivePattern.Groups.Count > 1
)
{
var groupValue = recursivePattern.Groups[1].Value;
path = path.Replace(
recursivePattern.Value,
FormatPath(groupValue, guild, channel.Parent, after, before)
);
}

return Regex.Replace(
path,
"%.",
m =>
Expand Down Expand Up @@ -187,10 +202,12 @@ private static string FormatPath(
.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
"%%" => "%",
"%r" => string.Empty,
_ => m.Value
}
)
);
}

private static string GetOutputBaseFilePath(
Guild guild,
Expand Down

0 comments on commit 897c99e

Please sign in to comment.