Skip to content

About

Bot to supply telegram channel with hot Reddit submissions.

Topics

Resources

Stars

293 stars

Watchers

6 watching

Forks

Repository files navigation

reddit2telegram

Hi there!

These bots just send latest hot submissions from subreddit /r/%subreddit% to telegram channel @r_%subreddit% hourly. For example /r/gifs → @r_gifs.

If you want to obtain your own channel for /r/%subreddit%:

  1. Create new public telegram channel @r_%subreddit%.
  2. Add @reddit2telegram_bot as administrator to this channel.
  3. Make a pull request to this repo with new script to make posts (use reddit2telegram/channels/r_funnny/app.py as draft), and the tags related (create a tags.txt containing at least 3 tags, separated by spaces and starting with #).
  4. Then I will make it alive :)
  5. For any questions do not hesitate to contact me in @r_channels group.

If you appreciate it

Patreon: donate

BTC: 3DydQjRPaykiapdeab6ABAhB5f2JazwaRD

ETH: 0xc313B7bEbFc605cC5B50fa97902506404D58df80

LTC: MT3gDG9VZvSDmsRexQ3k19JLxhDSCjf45T

Currently alive channels

Complete list of all active channels (more than 800) is available at our channel @reddit2telegram.

This is a pet-project 🐶

Which means you really shouldn't expect much from it. I wrote it over the weekend to solve my own pain. No state-of-art kubernetes bullshit, no architecture patterns, even no tests at all. It's here just to show people what a pet-project might look like.

This code has been written for fun, not for business. There is usually a big difference. Like between riding a bike on the streets and cycling in the wild for fun :)

© from infomate.club

Running it

Easiest way is to ask for new channel at @r_channels. Or follow the manual as stated above. :)

But if you are geek enough then install mongodb, ffmpeg, python and setup cron:

46 * * * * /root/reddit2telegram/auto_update.sh
* * * * * /root/reddit2telegram/reddit2telegram/cron_thread_job.sh

Versions and contributions

VERSION records the current stable version, starting at 1.0.0. See Changelog.md for release notes. Every change goes through a PR, including maintenance and channel additions. Maintainers may merge their own PRs after validation; direct pushes to master are prohibited.

The compatibility contract covers documented CLI arguments and configuration, persisted MongoDB formats requiring migration, and established posting behavior. Following SemVer, incompatible changes increment major, compatible new features/channels and deprecations increment minor, and compatible fixes and maintenance increment patch. Each PR makes one release increment and includes one SemVer: major, SemVer: minor, or SemVer: patch line in its body. The initial release PR uses SemVer: bootstrap.

On a fresh topic branch, prepare and validate a release:

git config core.hooksPath scripts/hooks
git fetch origin
git switch -c fix/example origin/master
python3 scripts/release.py bump patch --summary 'Describe the change for operators.'
python3 scripts/release.py validate --base-ref origin/master --bump patch
python3 -m unittest discover -s tests -p test_release.py
git push -u origin HEAD

Include VERSION, Changelog.md, and the implementation in the PR. Refresh the bump if another release merges first. Use squash or merge commits. After a validated PR merges, GitHub Actions publishes the matching vX.Y.Z tag and release notes; existing tags are immutable. Release checks use no application credentials and never send Telegram messages.

Tests

The consumer keeps at most consumer.max_pending submitted jobs (default: pool size). Video uploads are limited to four at a time. On glibc systems, pool.malloc_arenas defaults to four to reduce memory retained by native allocation pools. SIGTERM/SIGINT stop new claims and drain submitted work.

Live integration tests send real messages to @r_channels_test and use Reddit API.

R2T_LIVE_TESTS=1 /root/reddit2telegram/.venv/bin/python -m unittest tests/test_live_send.py

Live resource regression tests verify actual Telegram message IDs, repeated-job and exception cleanup, six concurrent video jobs with the four-upload limit, photo/GIF/gallery delivery, video download and audio merging, and live Reddit-to-Telegram supply. They generate media locally and serve video inputs on loopback; Telegram receives real uploads. Messages are paced, and media files are isolated from production's temporary-file cleaner. All sends target @r_channels_test; the configured bot must have posting rights there.

R2T_LIVE_TESTS=1 .venv/bin/python -m unittest tests/test_live_resources.py -v

Leave R2T_LIVE_TESTS unset during offline test runs.

About

Bot to supply telegram channel with hot Reddit submissions.

Topics

Resources

Stars

293 stars

Watchers

6 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages