Skip to content

feat: broaden reddit to use rxddit - #536

Open
Sn0wCrack wants to merge 2 commits into
v2from
feature/add-rx-reddit-embed-support
Open

feat: broaden reddit to use rxddit#536
Sn0wCrack wants to merge 2 commits into
v2from
feature/add-rx-reddit-embed-support

Conversation

@Sn0wCrack

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the previous Reddit handler with a new RxRedditSite implementation that expands Reddit URL handling and rewrites Reddit post links to use rxddit.com, while keeping the existing media?url= decode behavior.

Changes:

  • Swap the DI registration from RedditSite to RxRedditSite.
  • Add RxRedditSite with broader Reddit URL matching and rxddit link rewriting; remove the old RedditSite.
  • Update unit tests and benchmarks to use RxRedditSite.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SaucyBot/Site/ServiceRegistration.cs Registers RxRedditSite as the IRedditSite implementation.
SaucyBot/Site/Reddit/RxReddit.cs New Reddit site implementation with a broader regex and rxddit rewrite behavior.
SaucyBot/Site/Reddit/Reddit.cs Removes the old Reddit implementation.
SaucyBot.Tests/Unit/Site/RedditTest.cs Updates tests to construct RxRedditSite (still only covers media?url= path).
SaucyBot.Tests.Benchmark/Benchmarks/SiteMatchingBenchmarks.cs Updates benchmark wiring to use RxRedditSite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
public override string Identifier => "Reddit";

[GeneratedRegex(@"https?://(www\.)?reddit\.com/(r/(?<subreddit>\S+)/(comments|s)/(?<id>\S+)|media\?url=(?<url>[A-Z0-9\%\.]+))", RegexOptions.IgnoreCase | RegexOptions.Multiline)]
Comment on lines +27 to +33
public override async Task<ProcessResponse?> Process(ProcessRequest request)
{
// Handle mangled URLs first if match exists
return request.Match.Groups["url"].Success
? HandleMangledUrl(request.Match.Groups["url"].Value)
: HandleRedditPost(request.Match.Groups["subreddit"], request.Match.Groups["id"]);
}
Comment on lines +42 to +45
return new ProcessResponse()
{
Text = $"https://rxddit.com/r/{subreddit.Value}/comments/{id.Value}"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants