-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from Tishka17/develop
2.3.0
- Loading branch information
Showing
125 changed files
with
1,371 additions
and
678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
line-length = 79 | ||
target-version="py39" | ||
src = ["src"] | ||
|
||
include = ["src/**.py", "tests/**.py", "example/**.py"] | ||
exclude = ["docs"] | ||
|
||
lint.select = ["ALL"] | ||
lint.ignore = [ | ||
"ANN", | ||
"ARG", | ||
"D", | ||
"DTZ", | ||
"TD", | ||
"A002", | ||
"ASYNC230", | ||
"BLE001", | ||
"EM101", | ||
"EM102", | ||
"FA100", | ||
"FBT001", | ||
"FBT002", | ||
"FIX002", | ||
"ISC002", | ||
"ISC003", | ||
"N818", | ||
"PLR0913", | ||
"PLW2901", | ||
"PYI034", | ||
"RET505", | ||
"S311", | ||
"SIM103", | ||
"SIM108", | ||
"SIM114", | ||
"TCH001", | ||
"TCH002", | ||
"TCH003", | ||
"TRY003", | ||
"TRY201", | ||
"TRY400", | ||
"UP007", | ||
"UP038", | ||
] | ||
|
||
|
||
[lint.per-file-ignores] | ||
"src/aiogram_dialog/tools/**" = [ | ||
"S101", | ||
"SLF001", | ||
"PTH", | ||
] | ||
"src/aiogram_dialog/test_tools/**"= [ | ||
"S101", | ||
"PTH" | ||
] | ||
"tests/**" = [ | ||
"TID252", | ||
"PLR2004", | ||
"S101", | ||
"INP001", | ||
"FBT003", | ||
] | ||
"example/**" = [ | ||
"INP001", | ||
"ERA001", | ||
"RUF001", | ||
"PTH", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from aiogram.filters.state import State, StatesGroup | ||
|
||
from aiogram_dialog import Window | ||
from aiogram_dialog.widgets.link_preview import LinkPreview | ||
from aiogram_dialog.widgets.text import Const | ||
|
||
|
||
class SG(StatesGroup): | ||
MAIN = State() | ||
SECOND = State() | ||
|
||
|
||
window = Window( | ||
Const("https://nplus1.ru/news/2024/05/23/voyager-1-science-data"), | ||
LinkPreview(is_disabled=True), | ||
state=SG.MAIN, | ||
) | ||
|
||
second_window = Window( | ||
Const("some text"), | ||
LinkPreview( | ||
url=Const("https://nplus1.ru/news/2024/05/23/voyager-1-science-data"), | ||
prefer_small_media=True, | ||
show_above_text=True, | ||
), | ||
state=SG.MAIN, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _link_preview: | ||
|
||
LinkPreview | ||
************* | ||
|
||
The **LinkPreview** widget is used to manage link previews in messages. | ||
|
||
Parameters: | ||
|
||
* ``url``: A ``TextWidget`` with URL to be used in the link preview. If not provided, the first URL found in the message will be used. | ||
* ``is_disabled``: that controls whether the link preview is displayed. If ``True``, the preview will be disabled. | ||
* ``prefer_small_media``: that controls if the media in the link preview should be displayed in a smaller size. Ignored if media size change is not supported. | ||
* ``prefer_large_media``: that controls if the media in the link preview should be enlarged. Ignored if media size change is not supported. | ||
* ``show_above_text``: that specifies whether the link preview should be displayed above the message text. If ``True``, link preview be displayed above the message text. | ||
|
||
|
||
Code example: | ||
|
||
.. literalinclude:: ./example.py | ||
|
||
.. autoclass:: aiogram_dialog.widgets.link_preview.LinkPreview | ||
:special-members: __init__ | ||
:members: render_link_preview, _render_link_preview |
Oops, something went wrong.