|
| 1 | +<p align="center"> |
| 2 | + <img src="Docs/logo.png"> |
| 3 | + <h1 align="center">Telegram RSS Bot</h1> |
| 4 | + <p align="center"> |
| 5 | + <a href="http://de1.hashbang.sh:7191"> |
| 6 | + <img alt="" src="http://de1.hashbang.sh:7191/build_state"> |
| 7 | + </a> |
| 8 | + <a href="https://github.com/bsimjoo/Telegram-RSS-Bot/labels/bug"> |
| 9 | + <img alt="Bug issue" src="https://img.shields.io/github/issues-raw/bsimjoo/Telegram-RSS-Bot/bug?color=red"> |
| 10 | + </a> |
| 11 | + <a href="http://de1.hashbang.sh:7191"> |
| 12 | + <img alt="Reported bugs from pcworms_bot project" src="https://img.shields.io/badge/dynamic/json?url=http://de1.hashbang.sh:7191/json&label=Bugs+found&query=$.Telegram_RSS_Bot.bugs_count&color=red"> |
| 13 | + </a> |
| 14 | + <a href="https://github.com/bsimjoo/Telegram-RSS-Bot/labels/todo"> |
| 15 | + <img src="https://img.shields.io/github/issues-raw/bsimjoo/Telegram-RSS-Bot/todo?color=orange&label=TODOs"> |
| 16 | + </a> |
| 17 | + <a href="https://github.com/bsimjoo/Telegram-RSS-Bot/releases"> |
| 18 | + <img src="https://img.shields.io/github/v/release/bsimjoo/Telegram-RSS-Bot"> |
| 19 | + </a> |
| 20 | + <a href="LICENSE.md"> |
| 21 | + <img src="https://img.shields.io/github/license/bsimjoo/Telegram-RSS-Bot"> |
| 22 | + </a> |
| 23 | + <img src="https://img.shields.io/badge/Python-v3.8-blue"> |
| 24 | + <a href="https://core.telegram.org/bots/api-changelog"> |
| 25 | + <img src="https://img.shields.io/badge/Bot%20API-5.1-blue?logo=telegram"> |
| 26 | + </a> |
| 27 | + </p> |
| 28 | + <p align="center"> |
| 29 | + A simple telegram bot that started for <a href="http://pcworms.blog.ir">pcworms.blog.ir</a> weblog that read RSS Feeds and send newest feed to all chats(in this article chats = [all PVs, all GPs and all channels]). |
| 30 | +Administrators can also send photos, markdown or simple text messages to chats.</p> |
| 31 | +</p> |
| 32 | + |
| 33 | +## Owner |
| 34 | +The person who runs bot-server and has telegram-bot token. He usually has access to source code and Databases. |
| 35 | + |
| 36 | +*Owner can change source of feeds but default source is `http://pcworms.blog.ir/rss` read [Installation](#installation)* |
| 37 | + |
| 38 | +### How the owner is identified |
| 39 | +Owner (bot call him as lord!) can identify himself using the token he got from @botfather like this: `/start {bot-token}` |
| 40 | + |
| 41 | +### Owner can: |
| 42 | +- Generate one-time tokens and add admins. (No remove option at now) |
| 43 | +- Get muted notification of bot join/kick from a GP or channel. |
| 44 | +- Get notification of Errors and Exceptions (usefull for report to me). |
| 45 | +- What Others (Admins and users) can do. |
| 46 | + |
| 47 | +## Admin |
| 48 | +A user can promote as admin just if Owner give him a one-time token who got from bot; |
| 49 | +then user can use one-time token for promotion like this: |
| 50 | +``` |
| 51 | +/start {token} |
| 52 | +``` |
| 53 | +Then Owner Receive a message with admin information and accept/decline button. |
| 54 | + |
| 55 | +### Admins can: |
| 56 | +- Send photo, markdown or simple text messages to all chats |
| 57 | +- Send last feed to all chats |
| 58 | +- Get bot statistics (chats, members and admins count) |
| 59 | +- Get a list of all chats with username, fullname and ... (except profile photo and phone number) |
| 60 | +- Change the interval between each check for a new post |
| 61 | + |
| 62 | +### Users can: |
| 63 | +- Get last feed |
| 64 | +- *No more option* |
| 65 | + |
| 66 | +--- |
| 67 | +`/help` command will give you a list of all available command related to user level. |
| 68 | + |
| 69 | +# Languages |
| 70 | +Available languages: |
| 71 | + - en-US |
| 72 | + - fa-IR |
| 73 | + - [*+Add more+*](https://github.com/bsimjoo/Telegram_RSS_bot/edit/main/default-strings.json) |
| 74 | +You can translate [default-strings.json](default-strings.json) file to add more languages but this bot will use same language for all users, I will make it multilingual for users in future. Owner and admin interface is hardcoded in english (except `/help` command) and [strings.json](strings.json) use to comunicating with users. |
| 75 | + |
| 76 | +**Notice** Rename you custom strings file to `strings.json` to prevent git pull errors. (`strings.json` is ignored for your custom version) |
| 77 | + |
| 78 | +# Installation: |
| 79 | +First of all admin need to create a new bot using telegram @BotFather and keep Bot-Token safe. then Download Comprressed Source or use git clone |
| 80 | +```bash |
| 81 | +git clone https://github.com/bsimjoo/Telegram_RSS_bot.git |
| 82 | +``` |
| 83 | + |
| 84 | +Change working directory to source directory and install requirements using this commands: |
| 85 | +``` |
| 86 | +cd ./Telegram_RSS_Bot |
| 87 | +python3 -m pip install --user -r requirements.txt |
| 88 | +``` |
| 89 | +wait until installation finish without any error. (You can report errors to me) |
| 90 | + |
| 91 | +Then configure and run the server for first use. |
| 92 | +``` |
| 93 | +python3 main.py -t {bot-token-here} -s {source-here} -l {language} |
| 94 | +``` |
| 95 | +The program will save the configurations for reuse in the database, so you do not need to reconfigure the server for the next run, unless you need to change them. |
| 96 | + |
| 97 | +Identify yourself as owner to bot. you can start a chat with your bot and then use this: |
| 98 | +``` |
| 99 | +/start {bot-token} |
| 100 | +``` |
| 101 | + |
| 102 | +# Reset databases |
| 103 | +If your about to reset database you can use `-r {database}` to reset `chats`, `config` or `all` databases. |
| 104 | + |
| 105 | +**:warning: This action can not be undone** |
| 106 | + |
| 107 | +# Bug Reporter |
| 108 | +I added a module that reports exceptions or any custom message and counts them, then I can show the number of bugs through a running server and then track and fix them. The bug reporter is not enabled by default, but if you are interested you can save the bugs to a local file `bug.json` by running the server with the `-b` argument, or run the bug report http server with `-b {port number}` to see them through an http server (click on the "Bugs found" badge to see an example). |
| 109 | + |
| 110 | +**Notice** Don't forget to install `cherrypy` for online bug reporter using `python3 -m pip install cherrypy` |
| 111 | + |
| 112 | +--- |
| 113 | +Using [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) api |
| 114 | + |
| 115 | +###### this is my first telegram bot! |
| 116 | +this project began for [pcworms.blog.ir](http://pcworms.blog.ir) weblog, but now it is available for everyone. you can see customised version at [pcworms/PCworms_Bot](https://github.com/pcworms/PCworms_Bot) |
0 commit comments