Skip to content
This repository was archived by the owner on May 17, 2022. It is now read-only.

Commit 4c50046

Browse files
committed
Merge branch 'main' into release
2 parents b370df9 + afd1ffb commit 4c50046

File tree

10 files changed

+365
-281
lines changed

10 files changed

+365
-281
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
README.md merge=ours
2-
Docs/ merge=ours
2+
Docs/ merge=ours
3+
config merge=ours

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ dmypy.json
128128
# Pyre type checker
129129
.pyre/
130130

131-
.db/
131+
.vscode/
132+
db/
133+
db.lmdb/
132134
*.mdb
133135
strings.json
134-
bugs.json
136+
bugs.json
137+
user-config.conf

Bug-reporter.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[global]
2+
server.socket_host = '0.0.0.0'
3+
server.socket_port = 7191
4+
log.screen = False

BugReporter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ def __init__(self, data:dict):
88
if data.get('commit') == commit:
99
self.data = data
1010
else:
11-
self.data = {'commit':commit, 'tags':dict(), 'bugs_count':0}
11+
self.data = {'commit':commit, 'tags':dict(), 'bugs_count':0, 'build':'passing'}
1212

13-
def bug(self, tag, message=None):
13+
def bug(self, tag, message=None, custom_prop={}):
1414
tags = self.data['tags']
1515
current_tag = tags.get(tag, {'count':0})
1616
current_tag['count'] += 1
1717
current_tag['message'] = message
18+
current_tag['custom-prop'] = custom_prop
1819
tags[tag] = current_tag
1920
self.data['bugs_count'] = len(tags)
21+
if len(tags):
22+
self.data['build']='failing'
2023

2124
class BugReporter:
2225
def __init__(self, file_path = 'bugs.json'):

Docs/build failing.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

Docs/build passing.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
<h1 align="center">Telegram RSS Bot</h1>
44
<p align="center">
55
<a href="http://de1.hashbang.sh:7191">
6-
<img alt="" src="http://de1.hashbang.sh:7191/build_state">
6+
<img alt="" src="https://img.shields.io/badge/dynamic/json?url=http://de1.hashbang.sh:7191/json&label=build&query=$.Telegram_RSS_Bot.build&color=white">
7+
<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">
78
</a>
89
<a href="https://github.com/bsimjoo/Telegram-RSS-Bot/labels/bug">
910
<img alt="Bug issue" src="https://img.shields.io/github/issues-raw/bsimjoo/Telegram-RSS-Bot/bug?color=red">
1011
</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>
1412
<a href="https://github.com/bsimjoo/Telegram-RSS-Bot/labels/todo">
1513
<img src="https://img.shields.io/github/issues-raw/bsimjoo/Telegram-RSS-Bot/todo?color=orange&label=TODOs">
1614
</a>
1715
<a href="https://github.com/bsimjoo/Telegram-RSS-Bot/releases">
1816
<img src="https://img.shields.io/github/v/release/bsimjoo/Telegram-RSS-Bot">
17+
<img alt="GitHub release (latest SemVer including pre-releases)" src="https://img.shields.io/github/v/release/bsimjoo/Telegram-RSS-Bot?include_prereleases&label=pre-release">
1918
</a>
2019
<a href="LICENSE.md">
2120
<img src="https://img.shields.io/github/license/bsimjoo/Telegram-RSS-Bot">
@@ -41,7 +40,7 @@ Owner (bot call him as lord!) can identify himself using the token he got from @
4140
### Owner can:
4241
- Generate one-time tokens and add admins. (No remove option at now)
4342
- Get muted notification of bot join/kick from a GP or channel.
44-
- Get notification of Errors and Exceptions (usefull for report to me).
43+
- Get notification of Errors and Exceptions (useful for report to me).
4544
- What Others (Admins and users) can do.
4645

4746
## Admin
@@ -56,15 +55,15 @@ Then Owner Receive a message with admin information and accept/decline button.
5655
- Send photo, markdown or simple text messages to all chats
5756
- Send last feed to all chats
5857
- 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)
58+
- Get a list of all chats with username, full-name and ... (except profile photo and phone number)
6059
- Change the interval between each check for a new post
6160

6261
### Users can:
6362
- Get last feed
6463
- *No more option*
6564

6665
---
67-
`/help` command will give you a list of all available command related to user level.
66+
`/help` command will give you a list of all available command related to your access.
6867

6968
# Languages
7069
Available languages:
@@ -76,41 +75,45 @@ You can translate [default-strings.json](default-strings.json) file to add more
7675
**Notice** Rename you custom strings file to `strings.json` to prevent git pull errors. (`strings.json` is ignored for your custom version)
7776

7877
# 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
78+
First of all admin need to create a new bot using telegram @BotFather and keep Bot-Token safe. then Download Compressed Source or use git clone
8079
```bash
8180
git clone https://github.com/bsimjoo/Telegram_RSS_bot.git
8281
```
8382

8483
Change working directory to source directory and install requirements using this commands:
85-
```
84+
```bash
8685
cd ./Telegram_RSS_Bot
8786
python3 -m pip install --user -r requirements.txt
8887
```
8988
wait until installation finish without any error. (You can report errors to me)
9089

91-
Then configure and run the server for first use.
92-
```
93-
python3 main.py -t {bot-token-here} -s {source-here} -l {language}
90+
Then configure server. this repository may update `config-example.conf`, but `user-config.conf` is ignored and it is for users
91+
```bash
92+
cp config-example.conf user-config.conf
9493
```
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.
94+
Edit `user-config.conf` with a text editor, if you want to know about Bug-Reporter [see Bug reporter below](#bug-reporter--)
9695

96+
Then run server
97+
```bash
98+
python3 main.py
99+
```
97100
Identify yourself as owner to bot. you can start a chat with your bot and then use this:
98101
```
99102
/start {bot-token}
100103
```
101104

102105
# Reset databases
103-
If your about to reset database you can use `-r {database}` to reset `chats`, `config` or `all` databases.
106+
If your about to reset database you can use `-r {database}` to reset `chats`, `data` or `all` databases.
104107

105-
**:warning: This action can not be undone**
108+
<b>:warning: <font color="orange">This action can not be undone</font></b>
106109

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).
110+
# Bug Reporter [![Bugs](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) ![build](https://img.shields.io/badge/dynamic/json?url=http://de1.hashbang.sh:7191/json&label=build&query=$.Telegram_RSS_Bot.build&color=white)](http://de1.hashbang.sh:7191)
111+
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 then track and fix them. 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 an http server (click on [![Bugs](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) or ![build](https://img.shields.io/badge/dynamic/json?url=http://de1.hashbang.sh:7191/json&label=build&query=$.Telegram_RSS_Bot.build&color=white)](http://de1.hashbang.sh:7191) badge to see an example). The default configuration of the http bug reporter is saved in `Bug-reporter.conf` but you can config server to use your own config file.
109112

110-
**Notice** Don't forget to install `cherrypy` for online bug reporter using `python3 -m pip install cherrypy`
113+
**Notice** Don't forget to install `cherrypy` before using http bug reporter. use `python3 -m pip install cherrypy`
111114

112115
---
113116
Using [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) api
114117

115118
###### 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)
119+
this project began for [pcworms.blog.ir](http://pcworms.blog.ir) weblog, but now it is available for everyone. you can see customized version at [pcworms/PCworms_Bot](https://github.com/pcworms/PCworms_Bot)

config-example.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[main]
2+
# in telegram use @botfather to create a bot and then paste token here
3+
token = your bot token
4+
5+
source = https://pcworms.blog.ir/rss/
6+
language = en-us
7+
strings-file = Default-strings.json
8+
log-level = info
9+
10+
# specify path of file based database [CRITICAL]
11+
db-path = db.lmdb
12+
13+
# uncomment to save logs to file instead of console output
14+
# log-file = log.log
15+
16+
bug-reporter = off
17+
# bug reporter modes:
18+
# off Disable bug-reporter
19+
# offline Saves bugs in bugs-file
20+
# online Saves bugs in file and also runs a http server, you can configure
21+
# HTTP-server (using cherrypy) in [bug-reporter] section
22+
# if you're going to run bug-reporter in online mode, make sure you have cherrypy installed
23+
# or use "python3 -m pip install cherrypy" to install it
24+
# bugs file needed if bug-reporter is not off
25+
bugs-file = ./bugs.json
26+
reporter-config-file = Bug-reporter.conf

default-strings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"en-us":{
3-
"wellcome": [
3+
"welcome": [
44
"Hi, I'm open\\-source [telegram RSS bot](https://github.com/bsimjoo/Telegram_RSS_bot) ",
5-
"wroten by [BSimjoo](https://github.com/bsimjoo) and this is a default message\\.\n",
5+
"wrote by [BSimjoo](https://github.com/bsimjoo) and this is a default message\\.\n",
66
"*Owner can edit this message in strings\\.json file*"
77
],
88
"group-intro": [
99
"Hi everybody, I'm open\\-source [telegram RSS bot](https://github.com/bsimjoo/Telegram_RSS_bot) ",
10-
"wroten by [BSimjoo](https://github.com/bsimjoo) and this is a default message\\.\n",
10+
"wrote by [BSimjoo](https://github.com/bsimjoo) and this is a default message\\.\n",
1111
"*Owner can edit this message in strings\\.json file*"
1212
],
1313
"new-feed": "🆕♨️New post on weblog:",
@@ -28,12 +28,12 @@
2828
"/last_feed Get last post of weblog\n\n",
2929
"/help Show this help"
3030
],
31-
"time-limit-error": "Sorry, I can not answer you right now because of time limition between two request, try again 2 mins later.",
31+
"time-limit-error": "Sorry, I can not answer you right now because of time limitation between two request, try again 2 mins later.",
3232
"unknown": "Unknown command",
3333
"unknown-msg": "Sorry, I can't chat with anyone right now!"
3434
},
3535
"fa-ir": {
36-
"wellcome": [
36+
"welcome": [
3737
"سلام، من ربات متن باز ",
3838
"(Telegram RSS Bot)[https://github.com/bsimjoo/Telegram_RSS_bot] ",
3939
"هستم و توسط ",

0 commit comments

Comments
 (0)