Skip to content

A telegram bot for sending latest feed of a site or weblog to all users

License

Notifications You must be signed in to change notification settings

b-simjoo/Telegram-RSS-Bot

Β 
Β 

Repository files navigation

Telegram-RSS-Bot

This project had stopped contributing on 05/17/2022 and was rebased at telegram-post-bot

It is highly recommended to stop forking this repo and see the telegram-post-bot repository

Reported bugs from pcworms_bot project goto running version Bug issue CodeFactor Grade GitHub release (latest SemVer including pre-releases)
Donate Web page

A simple telegram bot that read RSS Feeds and send newest feed to all chats(in this article chats = [all PVs, all GPs and all channels]). Administrators can also send photos, html or simple text messages to chats and ...

πŸš€ Getting started

Follow Telegram instructions to create a new bot user and get your Bot-Token. keep your Bot-Token safe.

Then download latest release or use git clone.

git clone https://github.com/bsimjoo/Telegram_RSS_bot.git

Note: Telegram-RSS-Bot is always under active development, so if you're looking for a stable and safe release, use the compressed packages or checkout to release branch.

use this:

git checkout release

OR just run this command instead of the one above:

git clone https://github.com/bsimjoo/Telegram_RSS_bot.git --branch release

Update

Highly recommended to keep your server up to date. if you are using git you can do an update with git pull

⬇️ Installation

First install python. I recommend Python v3.8+ because this project developed and tested with this version. So if you had any problem you can create an issue

change dir to source directory and install requirements with

cd Telegram-RSS-Bot
python3 -m pip install {--user} -r requirements.txt

--user flag is optional and may needed in some situation

βš™οΈ Configuration

Copy default configuration example config-example.jsonc to user-config.jsonc and do configuration. Read docs/Configuration-guide.md

Note that config-example.jsonc may be updated, so check for changes in each update. user-config.jsonc and also user-config.conf for older versions are ignored by git to prevent git problems but new versions may need new configurations, so keep configurations up to date.

πŸƒ Run server

use python main.py to run server, you can also run server with a new config file with python main.py -c {config file path} (Default configurations are user-config.jsonc if exists, else config-example.jsonc). run python main.py -h to get help about available arguments.

πŸ‘₯ Access levels

There are three levels of access for the bot. (Owner, Admins, Users)

πŸ‘‘ Owner

The person who runs bot-server and has telegram-bot token. He usually has access to source code and Databases. Owner can also change source of feeds but default source is http://pcworms.ir/rss read Installation at top

How the owner is identified

Owner (bot call him as lord!) can identify himself using the token he received previously from @botfather as follow

/start {bot-token}

Owner can:

  • Generate one-time tokens and add admins. (No remove option at now)
  • Get muted notification of bot join/kick from a GP or channel.
  • Get notification of Errors and Exceptions (useful for report to me).
  • What Others (Admins and users) can do.

😎 Admin

A user can only be promoted as an administrator if the owner generates a one-time token with the /gentoken command and gives it to the user (this token is not the token previously received from BOTFATHER during the setup process). The user can then request once using the token they received, and the robot notifies its owner that the user is requesting a promotion, then the administrator can accept or decline the request. If the owner accepts the request, the user will be promoted and recognized as an administrator.

/start {one-time token generated by this bot}

Owner will Receive a message with admin information and accept/decline buttons.

Admins can:

  • Send photo, HTML or simple text messages to all chats
  • Send last feed to all chats
  • Get bot statistics (chats, members and admins count)
  • Get a list of all chats with username, full-name and ... (except profile photo and phone number)
  • Change the interval between each check for a new post

πŸ§‘ Users can:

  • Get last feed
  • No more option

/help command will give you a list of all available command related to your access level.

πŸ‘… Languages

Available languages are:

  • en-US
  • fa-IR
  • +Add more+

You can translate default-strings.json file to add more languages but this bot will use same language for all users. Owner and admin interface is hardcoded in english (except /help command).

Notice set your custom strings file path in configuration.

πŸ”ƒ Reseting databases

If you're about to reset database you can use -r {database} argument to reset chats, data or all databases.

⚠️ This action can not be undone

πŸͺ² Bug Reporter

I'm already running an instace of this bot on hashbang server for my blog at pcworms.ir. So if the bot bugs, it will be displayed live here I wrote a module that reports exceptions or any custom message and counts them, then I can show the number of bugs of a running server and also build-state and then track and fix bugs. The bug reporter is off by default, but if you are interested you can save the bugs to a local file bugs.json in offline mode, or run the bug report http server in online mode to see them through a http server (click on bugs or build at top to see an example). The default configuration of the http bug reporter is saved in Bug-reporter.conf but you can add your own config file to server config file (user-config.conf).

Notice Don't forget to install cherrypy before using http bug reporter. use python3 -m pip install cherrypy

🚦 License GPL-v3

This project licensed under GPL-v3

The Telegram-RSS-Bot logo

the "Telegram-RSS-Bot" logo and any parts thereof are Copyright (Β©) 2021 by BSimjoo. All rights reserved.


Using python-telegram-bot api this project began for pcworms.ir weblog, but now it is available for everyone. you can see customized version at pcworms/PCworms_Bot

this is my first telegram bot!

About

A telegram bot for sending latest feed of a site or weblog to all users

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%