Skip to content

Commit a7e607d

Browse files
authored
Merge pull request #6 from Amaimersion/1.2.0
1.2.0
2 parents 2066862 + 3bb4418 commit a7e607d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6720
-1353
lines changed

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ FLASK_SECRET_KEY=
1212
# PostgreSQL is expected in production, but not required
1313
DATABASE_URL=postgresql+psycopg2://<user>:<password>@<host>:<port>/<db_name>
1414

15+
# Address of Redis server. Optional.
16+
# If address will be specified, then the app will assume
17+
# that valid instance of Redis server is running, and the app
18+
# will not make any checks (like `PING`). So, make sure you
19+
# pointing to valid Redis instance.
20+
REDIS_URL=
21+
1522
# API token received from @BotFather for Telegram bot
1623
TELEGRAM_API_BOT_TOKEN=
1724

.flake8

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[flake8]
2-
ignore = F401, W504
2+
ignore =
3+
F401,
4+
W504,
5+
E261
36
exclude =
47
# Folders
58
__pycache__

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ venv
1313

1414
# Secrets
1515
instance
16-
.env
16+
.env*
17+
!.env.example

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: Flask",
6+
"type": "python",
7+
"request": "launch",
8+
"module": "flask",
9+
"env": {
10+
"FLASK_APP": "wsgi.py",
11+
"FLASK_ENV": "development",
12+
"FLASK_DEBUG": "0",
13+
"CONFIG_NAME": "development"
14+
},
15+
"args": [
16+
"run",
17+
"--no-debugger",
18+
"--no-reload",
19+
"--port",
20+
"8000"
21+
],
22+
"jinja": true,
23+
"console": "integratedTerminal"
24+
}
25+
]
26+
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"python.pythonPath": "./venv/bin/python",
2+
"python.pythonPath": "venv/bin/python",
33
"python.autoComplete.extraPaths": [
44
"./src/*"
55
],
6-
"cornflakes.linter.executablePath": "./venv/bin/flake8",
6+
"cornflakes.linter.executablePath": "venv/bin/flake8",
77
"files.exclude": {
88
"venv": true,
99
"**/__pycache__": true,

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
# 1.2.0 (December 14, 2020)
2+
3+
## Telegram Bot
4+
5+
### Improved
6+
7+
- Text of some bot responses.
8+
- Formatting of help message.
9+
- `/upload`: multiple items will be handled at a same time, not one by one.
10+
11+
### Added
12+
13+
- `/public_upload_photo`, `/public_upload_file`, `/public_upload_audio`, `/public_upload_video`, `/public_upload_voice`, `/public_upload_url`: uploading of files and then publishing them.
14+
- `/publish`: publishing of files or folders.
15+
- `/unpublish`: unpublishing of files or folders.
16+
- `/space_info`: getting of information about remaining Yandex.Disk space.
17+
- `/element_info`: getting of information about file or folder.
18+
- `/disk_info`: getting of information about Yandex.Disk.
19+
- `/commands`: full list of available commands without help message.
20+
- `/upload_url`: added `youtube-dl` support.
21+
- Handling of files that exceed file size limit in 20 MB. At the moment the bot will asnwer with warning message, not trying to upload that file. [#3](https://github.com/Amaimersion/yandex-disk-telegram-bot/issues/3)
22+
- Now you can forward many attachments and add single command. This command will be applied to all forwarders attachments.
23+
- Now you can send many attachments as a one group and add single command. This command will be applied to all attachments of that group.
24+
- Help messages for each upload command will be sended when there are no suitable input data.
25+
26+
### Changed
27+
28+
- `/create_folder`: now it will wait for folder name if you send empty command, not deny operation.
29+
- `/upload`: on success it will return information about uploaded file, not plain status.
30+
- `/upload`: increase maxium time of checking of operation status from 10 seconds to 16.
31+
- `/upload_url`: result name will not contain parameters, queries and fragments.
32+
- `/upload_voice`: result name will be ISO 8601 date, but without `T` separator (for example, `2020-11-24 09:57:46+00:00`), not ID from Telegram.
33+
34+
### Fixed
35+
36+
- `/create_folder`: fixed a bug when bot could remove `/create_folder` occurrences from folder name.
37+
- `/create_folder`: fixed a bug when bot don't send any responses on invalid folder name.
38+
- Wrong information in help message for `/upload_video`.
39+
- A bug when paths with `:` in name (for example, `Telegram Bot/folder:test`) led to `DiskPathFormatError` from Yandex.
40+
41+
## Project
42+
43+
### Improved
44+
45+
- Upgrade `python` to 3.8.5.
46+
- All requirements upgraded to latest version.
47+
- Big refactoring.
48+
49+
### Added
50+
51+
- Stateful chat support. Now bot can store custom user data (in different namespaces: user, chat, user in chat); determine Telegram message types; register single use handler (call once for message) with optional timeout for types of message; subscribe handlers with optional timeout for types of messages.
52+
- [Console Client](https://yandex.ru/dev/oauth/doc/dg/reference/console-client.html) Yandex.OAuth method. By default it is disabled, and default one is [Auto Code Client](https://yandex.ru/dev/oauth/doc/dg/reference/auto-code-client.html/).
53+
- RQ (job queue). It requires Redis to be enabled, and as Redis it is also optional. However, it is highly recommended to use it.
54+
- Support for different env-type files (based on current environment). Initially it was only for production.
55+
- Web Site: 302 (redirect to Telegram) will be returned instead of 404 (not found page), but only in production mode.
56+
- Debug configuration for VSCode.
57+
- DB: add indexes for frequent using columns.
58+
59+
### Changed
60+
61+
- Redirect to favicon will be handled by nginx.
62+
- Biggest photo (from single photo file) will be selected based on total pixels count, not based on height.
63+
64+
### Fixed
65+
66+
- A bug when new user (didn't use any command before) used `/revoke_access` command and it led to request crash (500).
67+
- Situation: Telegram send an update, the server sent back a 500; Telegram will send same update again and again until it get 200 from a server, but server always returns 500. Such sitations can occur, for example, when user initiated a command and blocked the bot - bot can't send message to user in this case (it gets 403 from Telegram API, so, server raises error because it is an unexpected error and should be logged). Now it is fixed and the bot always send back 200, even for such error situations.
68+
69+
170
# 1.1.0 (May 9, 2020)
271

372
## Telegram Bot

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
release: . ./scripts/env/production.sh; flask db upgrade
22
web: bin/start-nginx bash ./scripts/wsgi/production.sh gunicorn
3+
worker: . ./scripts/env/production.sh; python worker.py

0 commit comments

Comments
 (0)