Skip to content

Commit

Permalink
Merge pull request #6 from Amaimersion/1.2.0
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
Amaimersion authored Dec 14, 2020
2 parents 2066862 + 3bb4418 commit a7e607d
Show file tree
Hide file tree
Showing 74 changed files with 6,720 additions and 1,353 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ FLASK_SECRET_KEY=
# PostgreSQL is expected in production, but not required
DATABASE_URL=postgresql+psycopg2://<user>:<password>@<host>:<port>/<db_name>

# Address of Redis server. Optional.
# If address will be specified, then the app will assume
# that valid instance of Redis server is running, and the app
# will not make any checks (like `PING`). So, make sure you
# pointing to valid Redis instance.
REDIS_URL=

# API token received from @BotFather for Telegram bot
TELEGRAM_API_BOT_TOKEN=

Expand Down
5 changes: 4 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[flake8]
ignore = F401, W504
ignore =
F401,
W504,
E261
exclude =
# Folders
__pycache__
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ venv

# Secrets
instance
.env
.env*
!.env.example
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "wsgi.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0",
"CONFIG_NAME": "development"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"--port",
"8000"
],
"jinja": true,
"console": "integratedTerminal"
}
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"python.pythonPath": "./venv/bin/python",
"python.pythonPath": "venv/bin/python",
"python.autoComplete.extraPaths": [
"./src/*"
],
"cornflakes.linter.executablePath": "./venv/bin/flake8",
"cornflakes.linter.executablePath": "venv/bin/flake8",
"files.exclude": {
"venv": true,
"**/__pycache__": true,
Expand Down
69 changes: 69 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,72 @@
# 1.2.0 (December 14, 2020)

## Telegram Bot

### Improved

- Text of some bot responses.
- Formatting of help message.
- `/upload`: multiple items will be handled at a same time, not one by one.

### Added

- `/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.
- `/publish`: publishing of files or folders.
- `/unpublish`: unpublishing of files or folders.
- `/space_info`: getting of information about remaining Yandex.Disk space.
- `/element_info`: getting of information about file or folder.
- `/disk_info`: getting of information about Yandex.Disk.
- `/commands`: full list of available commands without help message.
- `/upload_url`: added `youtube-dl` support.
- 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)
- Now you can forward many attachments and add single command. This command will be applied to all forwarders attachments.
- 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.
- Help messages for each upload command will be sended when there are no suitable input data.

### Changed

- `/create_folder`: now it will wait for folder name if you send empty command, not deny operation.
- `/upload`: on success it will return information about uploaded file, not plain status.
- `/upload`: increase maxium time of checking of operation status from 10 seconds to 16.
- `/upload_url`: result name will not contain parameters, queries and fragments.
- `/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.

### Fixed

- `/create_folder`: fixed a bug when bot could remove `/create_folder` occurrences from folder name.
- `/create_folder`: fixed a bug when bot don't send any responses on invalid folder name.
- Wrong information in help message for `/upload_video`.
- A bug when paths with `:` in name (for example, `Telegram Bot/folder:test`) led to `DiskPathFormatError` from Yandex.

## Project

### Improved

- Upgrade `python` to 3.8.5.
- All requirements upgraded to latest version.
- Big refactoring.

### Added

- 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.
- [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/).
- RQ (job queue). It requires Redis to be enabled, and as Redis it is also optional. However, it is highly recommended to use it.
- Support for different env-type files (based on current environment). Initially it was only for production.
- Web Site: 302 (redirect to Telegram) will be returned instead of 404 (not found page), but only in production mode.
- Debug configuration for VSCode.
- DB: add indexes for frequent using columns.

### Changed

- Redirect to favicon will be handled by nginx.
- Biggest photo (from single photo file) will be selected based on total pixels count, not based on height.

### Fixed

- A bug when new user (didn't use any command before) used `/revoke_access` command and it led to request crash (500).
- 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.


# 1.1.0 (May 9, 2020)

## Telegram Bot
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
release: . ./scripts/env/production.sh; flask db upgrade
web: bin/start-nginx bash ./scripts/wsgi/production.sh gunicorn
worker: . ./scripts/env/production.sh; python worker.py
Loading

0 comments on commit a7e607d

Please sign in to comment.