tolik518 / tolik518/factorion-bot

`lang` not correctly set for most subreddits

Open
#268 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

reddit-bot
Dominant language
Rust
Stars
51
Forks
8
PR merge metrics
No merged PRs in 30d

Description

The Reddit API doesn't always tells us the correct language, as I figured out in #267. The language-feature was partially removed (it can't be set anymore in the UI, only in the API).
While the legacy language was removed from the UI, another language setting was added, which doesn't expose with the API.
Apart from that, the language-identifiers are not ISO 639-1 as expected. They are pretty much a mess. Mexican is "es-mx" for example (which isn't a huge issue).

This leads for us to not being able to identify the correct language of most non-english subreddits.

The current config has some architectural limitations, which makes it not possible to add default subreddit-languages without them being parsed (also too many subreddits here would make the reddit api too long at some point).

SUBREDDITS=mathmemes:en+mathmemescirclejerk:en+unexpectedfactorial:en+factorialchain:en+doublefactorialchain:en+theydidthemath:en:shorten+theydidthemonstermath:en+uselessfactorial:en+redundantfactorial:en+anticipatedfactorial:en+expectedfactorial:en+unexpectedTermial:en:termial+Notorite:tr

I see only one viable option here right now:

  • a dedicated subreddit_config similar to the channel_config for discord
  • SUBREDDITS in the .env should be added to the api url and parsed
  • subreddits in subreddit_config only store configurations
    • this would make it possible to configure default languages to subreddits by hand

Another option would be using an LLM to figure out the language of a subreddit and store it a the default language, this is quite overkill though (albeit might be a fun idea for a dedicated api)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how SUBREDDITS is parsed and how the Reddit API URL is built, then compare that flow with the existing Discord channel_config handling. Done means subreddit_config can store default subreddit languages and SUBREDDITS values are included in API requests and parsed without relying on Reddit's inconsistent language metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.