This is a script that will send hot/new/top/rising posts from a subreddit to a Telegram channel.
- Follow the setup instructions
- Add your Telegram bot as an admin to the channels you want to bridge
- Run the image replacing the volumes with the paths to your files:
docker run \
--volume /path/to/.env:/app/.env \
--volume /path/to/bridges.json:/app/bridges.json \
--volume /path/to/db:/app/db \
massolari/reddit-to-telegram:latest
Tip
You can create a shell script with the above command and run it as a cron job.
- Clone this repository
- Follow the setup instructions
- Add your Telegram bot as an admin to the channels you want to bridge
- Run the script:
gleam run
- Create a
.env
file and fill in the values (you can use.env.example
as a template):
# Your Reddit username and password
REDDIT_USERNAME=
REDDIT_PASSWORD=
# Reddit client ID and secret
# You can get these by creating an app on https://www.reddit.com/prefs/apps
# Make sure to set the app type to "script"
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
# Telegram bot token
# You can get this by creating a bot with @BotFather
TELEGRAM_TOKEN=
- Create the file
bridges.json
and fill in the values for the subreddits and channels you want to bridge (you can usebridges.example.json
as a template):
[
{
"subreddit": "gleamlang",
"reddit_sort": "hot",
"telegram_channel": "@r_gleam"
}
]
Field | Description |
---|---|
subreddit |
The subreddit to bridge in. It's the last part of the URL, for example, for the URL https://www.reddit.com/r/gleamlang the subreddit is gleamlang |
reddit_sort |
The sorting method to use when fetching posts from Reddit. Available options are hot , new , top and rising |
telegram_channel |
The Telegram channel to send the posts to. It's the channel username with the @ prefix, for example, for the URL https://t.me/r_gleam the channel is @r_gleam |
minimum_upvotes |
(Optional) The minimum number of upvotes a post must have to be sent to the channel. Default is 10 |