/RedditToTelegram

Push your favorite content from Reddit directly to your Telegram groups!🚀📬

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

RTT: A Reddit to Telegram bot

homepage (WIP) | manual (WIP) | faq (WIP) | wiki | chat (WIP) | news (WIP)


RTT (Reddit To Telegram) is a Bot that allows you to receive notification when there is a new post on your favourite subreddit.


Installation

It's very simple to deploy your own RTT bot. First of all you need to have a Reddit account and a Telegram bot (you can create it writing to the BotFather). Docker and docker-compose are strong prerequisites, but they're not mandatory. Now clone the repository:
git clone https://github.com/Polpetta/RedditToTelegram.git
and, run:
npm install
To deploy the service you have to define some environment variables in a file called bot-variables.env (put this file in the root of the repository). The variables are:

  • USER_AGENT: this is necessary because Reddit want for each bot a particular user agent.
  • CLIENT_ID: you can obtain this creating a new application from your account, selecting "script".
  • CLIENT_SECRET: you will get also this code when creating a new application in your Reddit account.
  • RUSERNAME: the Reddit username
  • RPASSWORD: the Reddit password
  • TTOKEN: the Telegram bot token
  • SUBREDDITNAME: the subreddit name where fetch new posts. For the moment you can only fetch only from one subreddit
  • ALLOW_NEW_SUBSCRIBERS: this is optional, and allow you to define if the bot can broadcast new posts to anyone who add it into a group or not
  • NODE_ENV: it's optional, and it can only be set to production. Set this only if you're going to put the bot in a production mode.
  • POLLING_TIME: it's an optional variable that defines how much RTT should poll Reddit APIs. Default is every 5 seconds. Pay attention that an additional second is added to avoid Reddit APIs limitations. Requests that go over Reddit APIs limits are queued and processed when possible.
Finally, if you have Docker and docker-compose installed on your system, just run:
npm run build && docker-compose up
If you're not using Docker, you need to set the variables in your terminal (with export keyword) and then run:
npm run build && npm start
Enjoy! :)

Contributing

At the moment, you can contribute posting bugs in the bug tracker. If you have some code which you would like merge, then open a pull request. Please write tests and documentation of the new code too.

License

All the project's code is under GPL v3+.