{"id":20948306,"url":"https://github.com/raine/tgreddit","last_synced_at":"2025-05-14T02:30:54.583Z","repository":{"id":37543232,"uuid":"505891746","full_name":"raine/tgreddit","owner":"raine","description":"Get the top posts of your favorite subreddits to Telegram","archived":false,"fork":false,"pushed_at":"2024-05-23T21:08:04.000Z","size":111,"stargazers_count":28,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T00:17:01.997Z","etag":null,"topics":["reddit","telegram"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-21T15:04:12.000Z","updated_at":"2024-09-23T00:11:06.000Z","dependencies_parsed_at":"2023-01-29T21:15:54.494Z","dependency_job_id":null,"html_url":"https://github.com/raine/tgreddit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raine%2Ftgreddit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raine%2Ftgreddit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raine%2Ftgreddit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raine%2Ftgreddit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raine","download_url":"https://codeload.github.com/raine/tgreddit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225270595,"owners_count":17447635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reddit","telegram"],"created_at":"2024-11-19T00:17:12.794Z","updated_at":"2024-11-19T00:17:13.939Z","avatar_url":"https://github.com/raine.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tgreddit\n\nA telegram bot that gives you a feed of top posts from your favorite subreddits.\n\nThe killer feature: No need to visit Reddit, as all media is embedded thanks to\n[yt-dlp][yt-dlp] and Telegram's excellent media support.\n\nIntended to be self-hosted, as Reddit's API has rate-limiting and downloading\nvideos with `yt-dlp` can be resource intensive. The simplest way to self-host is\nto use the prebuilt [docker image](#docker-image) that includes necessary\ndependencies.\n\n\u003cimg align=left src=\"https://user-images.githubusercontent.com/11027/178097057-83b27933-9876-405a-b151-a148960819df.jpeg\" width=20% height=20%\u003e\n\u003cimg align=left src=\"https://user-images.githubusercontent.com/11027/178096986-5f651336-8208-4c40-9c41-58c95173b24d.jpeg\" width=20% height=20%\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/11027/178099572-e55c7f3c-986b-4804-8540-1004b36950df.jpeg\" width=20% height=20%\u003e\n\n## install\n\n```sh\n$ cargo install tgreddit\n```\n\n### requirements\n\nDepends on [yt-dlp][yt-dlp] (and for good results, yt-dlp requires ffmpeg).\n\n## bot commands\n\n### `/sub \u003csubreddit\u003e [limit=\u003climit\u003e] [time=\u003ctime\u003e] [filter=\u003cfilter\u003e]`\n\nAdd a subscription to subreddit's top posts with optional options. Subscriptions\nare conversation specific, and may be added in channels where the bot is\nparticipating or in private chats with the bot.\n\nIf the options are not given, when checking for new posts, the program will\ndefault to configuration in config.toml, if any.\n\nExample: `/sub AnimalsBeingJerks limit=5 time=week filter=video`\n\nExplanation: Subscribe to top posts in r/AnimalsBeingJerks so that the top 5\nposts of the weekly top list are considered. Whenever a new post appears among\nthose top 5 posts, they will be posted in the conversation.\n\nSee the\n[example configuration](#example-toml-configuration-with-the-options-explained)\nbelow for further explanation on `limit`, `time`, and `filter`.\n\n### `/unsub \u003csubreddit\u003e`\n\nRemove a subscription from the current conversation.\n\n### `/listsubs`\n\nList all subreddit subscriptions for the current conversation.\n\n### `/get \u003csubreddit\u003e [limit=\u003climit\u003e] [time=\u003ctime\u003e] [filter=\u003cfilter\u003e]`\n\nGet the current top posts similarly to how subscribing to a subreddit would\nreturn new posts.\n\n## configuration\n\n### env vars\n\n- `CONFIG_PATH`: Path to TOML configuration file. **required**\n- `RUST_LOG`: Logging level. `info` recommended to see meaningful output.\n\n### example toml configuration with the options explained\n\nExample config without comments:\n[config.example.toml](https://raw.githubusercontent.com/raine/tgreddit/master/config.example.toml)\n\n```toml\n# Path to a SQLite database used to track seen posts.\n# Optional. Defaults to $HOME/.local/state/tgreddit/data.db3.\ndb_path = \"/path/to/data.db3\"\n\n# List of Telegram user ids that can use the commands provided by the bot.\nauthorized_users = [\n  123123123\n]\n\n# Token of your Telegram bot - you get this from @botfather.\ntelegram_bot_token = \"...\"\n\n# How often to query each configured subreddit for new posts. Applies only if\n# keep_running is enabled.\ncheck_interval_secs = 600\n\n# Whether posts seen on the first check of a new subreddit are considered new\n# or not. Generally having this enabled is better unless you want multiple new\n# messages when a new subreddit is added.\n# Optional. Defaults to true.\nskip_initial_send = true\n\n# Set the post comments links to use an alternative frontend. Useful as the\n# official Reddit web app is increasingly user hostile on mobile. Possible\n# alternative frontends include teddit.net and libredd.it, but you can use any.\n# Optional. Defaults to official Reddit.\nlinks_base_url = \"https://teddit.net\"\n\n# Set default limit of posts to fetch for each subreddit. Used when not\n# specified for a subreddit in the /sub command.\n#\n# Explanation in more detail: Whenever the bot gets the list of top posts for a\n# subreddit, it will only consider the first \u003climit\u003e posts. For example, if\n# your limit is 5, the first time around bot will see 5 new posts and mark those\n# as seen and not post anything because it's the first check. Next time around, if\n# there's an unseen post among those 5 top posts, it will be posted in Telegram.\n#\n# So essentially larger the number used as limit, the more posts you can\n# expect to see. For example, with time=month and limit=1 you would see a new post\n# only when the montly top post changes, which is not that often.\n#\n# Optional. The default is 1.\ndefault_limit = 1\n\n# Set default time period of top list fetched. Used when not specified for a\n# subreddit. String and one of: hour, day, week, month, year, all.\n# Optional. The default is `day`.\ndefault_time = \"day\"\n\n# Set default filter for post type. When fetching for new posts, only posts\n# matching the filter are considered.\n# String and one of: image, video, link, self_text, gallery\n# Optional and unset by default, meaning all post types are considered.\ndefault_filter = \"video\"\n```\n\nPerhaps the simplest way to determine a Telegram channel's ID is to open the\nchannel in [Telegram Web client][telegram-web] and observing the numeric value\nin page URL.\n\n## development\n\nThe project uses [`just`][just], [`direnv`][direnv] and [`entr`][entr].\n\n```sh\n$ just dev\n```\n\n## docker image\n\nThere's a prebuilt Docker image with dependencies included at\n[rainevi/tgreddit](https://hub.docker.com/repository/docker/rainevi/tgreddit).\n\nOf course, you may also build your own using from the\n[Dockerfile](https://raw.githubusercontent.com/raine/tgreddit/master/Dockerfile).\n\n## cross compiling for Raspberry Pi\n\nYou can cross-compile tgreddit for Raspberry Pi using a Docker container. The\nresulting executable will be statically linked and should work across different\nLinux distributions on the Raspberry Pi.\n\n```sh\ndocker run --rm -it \\\n\t-v \"$(pwd)\":/home/rust/src messense/rust-musl-cross:aarch64-musl \\\n\tcargo build --release --target aarch64-unknown-linux-gnu --features vendored-openssl\n```\n\n## have an idea, question or a bug report?\n\nFeel free to open an issue or start a new discussion.\n\n[yt-dlp]: https://github.com/yt-dlp/yt-dlp\n[telegram-web]: https://web.telegram.org/\n[just]: https://github.com/casey/just\n[direnv]: https://direnv.net/\n[entr]: https://github.com/eradman/entr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraine%2Ftgreddit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraine%2Ftgreddit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraine%2Ftgreddit/lists"}