Skip to content

Commit e6f5fa0

Browse files
authored
Add better readme (#1)
1 parent 5fb3326 commit e6f5fa0

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
11
# telegram-task-bot
2-
Telegrambot to ease the setup of recurring tasks.
2+
Library to setup telegram bots with recurring tasks.
33

4-
## Usage
4+
# Usage
55
`pip install telegram-task-bot`
66

7-
### `.env` Variables
7+
## `.env` Variables
88
1) `ALLOWED_USERS` specifies the users which are allowed, if `any`, every one is allowed to use the bot.
99
1) `BOT_TOKEN` the token of the bot.
10+
1) `START_MESSAGE` the message to be send as response to the start command.
1011

11-
## Example
12-
https://github.com/bb4L/digitec_daily_bot
12+
13+
## Classes
14+
There are several classes included in this Package.
15+
16+
### Task
17+
Base class for recurring tasks.
18+
19+
#### Configuration
20+
* `job_name: str` Name of the job defined in this task
21+
* `disable_notifications: bool` Disable notifications, flag send to the telegram server
22+
* `generic: bool` Defines if the task looks the same for each user
23+
* `first_time:time` First time to run the task, 0 is now takes a `datetime.time`
24+
* `repeat_time: timedelta` Defines the time between two executions of the job, takes `datetime.timedelta`
25+
* `filename: str` Filename under which data specific to this job should be saved
26+
27+
### GenericTask
28+
More specific class which adds the possiblity to get the actual value and implements user handling.
29+
The data is saved to a `JSON` file.
30+
The callback method ( `callback(self, context: telegram.ext.CallbackContext)`) must be implemented.
31+
32+
### UrlTask
33+
Extension of the `GenericTask` to simplify the usage for jobs calling a URL and returning the link/ response to the subscribers.
34+
It tries until it gets a response every 2 seconds.
35+
36+
This class adds a `url` field where the information lies.
37+
38+
The `handle_response(self, response: Response)` must be implemented to extract the data from the request and return the message string.
39+
40+
# Example Project
41+
https://github.com/bb4L/digitec_daily_bot
42+
43+
# License
44+
[LGPLv3](LICENSE)

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
setup(
44
name='telegram-task-bot',
5-
version='0.0.13',
6-
license='BSD-3',
7-
description='rpi-radio-alarm library',
5+
version='0.0.14',
6+
license='LGPLv3',
7+
description='Library for writing task based telegram bots',
88
long_description=open('README.md').read(),
99
long_description_content_type='text/markdown',
1010
author='bb4L',
1111
author_email='39266013+bb4L@users.noreply.github.com',
12-
url='https://github.com/bb4L/telegram-task-bot-pip',
12+
project_urls={"Source Code": "https://github.com/bb4L/telegram-task-bot-pip"},
1313
packages=['telegramtaskbot', 'telegramtaskbot.Tasks'],
1414
keywords=['Telegram', 'Bot'],
1515
install_requires=[
@@ -20,7 +20,7 @@
2020
'Development Status :: 4 - Beta',
2121
'Intended Audience :: Developers',
2222
'Topic :: Software Development',
23-
'License :: OSI Approved :: MIT License',
23+
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
2424
'Programming Language :: Python :: 3',
2525
'Programming Language :: Python :: 3.6',
2626
],

0 commit comments

Comments
 (0)