Commit graph

171 commits

Author SHA1 Message Date
Oleg A
83a01f014c
fix: added absent params for button builders (#1304)
* fix: added absent params for button builders

* docs: added changelog

* fix: renamed changelog item
2023-09-19 17:42:09 +03:00
Oleg A
995a0d7e9b
Custom encoding support (#1278)
* Custom encoding support in deep-linking
2023-09-03 00:26:57 +03:00
Alex Root Junior
5cf8d7b565
Add MediaGroupBuilder for media group construction (#1293)
Implemented a MediaGroupBuilder class in 'aiogram/utils/media_group.py' to help construct media groups. The class supports addition of different media types (audio, photo, video, document) to the media group with a maximum limit of 10 files. The functionality is demonstrated and usage is documented in 'docs/utils/media_group.rst'. Added related test cases in 'tests/test_utils/test_media_group.py'. This is to streamline and simplify the process of media group creation
2023-09-03 00:25:31 +03:00
Alex Root Junior
0161322598
Bump changelog 2023-09-01 18:04:42 +03:00
Alex Root Junior
04bd0c9e7c
Fixed error overlapping when validation error is caused by remove_unset root validator in base types and methods. (#1290)
* Ensure base type validation can handle non-dictionary values

The update introduces a condition to verify whether the values being validated are a dictionary before attempting to handle UNSET_TYPE in the aiogram base type. This adjustment helps to prevent potential errors or incorrect validation when non-dictionary values are faced.

* Added a test case for non-dictionary input in remove_unset method

* Added changelog

* Fixed tests
2023-08-29 02:01:54 +03:00
Alex Root Junior
e1be9dd668
Fix Message.send_copy method for stories (#1287)
* Fix `Message.send_copy` method for stories

Fixed an issue with the `Message.send_copy` method, which was not functioning properly with story-type messages. The `ForwardMessage` logic has been added to the method to enable copying of stories, in addition to other types. Tests and documentation have also been updated to reflect these changes.

* Typo fix
2023-08-28 22:32:11 +03:00
Alex Root Junior
6eb5ef2606
Replace datetime.datetime with DateTime across codebase (#1285)
* #1277  Replace datetime.datetime with DateTime across codebase

Replaced all instances of standard library 'datetime.datetime' with a new 'DateTime' type from `.custom` module. This change is necessary to make all date-time values compatible with the Telegram Bot API (it uses Unix time). This will simplify the conversion process and eliminate potential errors related to date-time format mismatches. Changed codebase, butcher files, and modified 'pyproject.toml' to shift the typing-extensions dependency. The 'aiogram/custom_types.py' file was renamed to 'aiogram/types/custom.py' to better reflect its nature as a location for custom types used in the aiogram library.
2023-08-27 17:09:56 +03:00
Alex Root Junior
397f30b58b
Fixed method :code:Message.send_copy for stickers (#1284) 2023-08-26 23:24:51 +03:00
Alex Root Junior
ee8e457c5f
#1281 Fix magic operation .as_ for values interpreted as False (#1283)
Modified the ".as_" method in the magic filter class to correctly handle values that are interpreted as `False` such as `0`. Previously, the method incorrectly dismissed these valid values. The issue was identified and fixed to ensure correct handling of all valid data inputs.
2023-08-26 22:33:32 +03:00
onejeuu
bff2ed0a86
Fix markdown italic quote (#1282)
* Fix markdown italic quote

* Add changelog
2023-08-26 22:31:30 +03:00
Alex Root Junior
787ad6b094
Render changelog 2023-08-18 20:21:01 +03:00
Alex Root Junior
678b3cfe7d
Bot API 6.8 (#1276)
* Prepare for Bot API 6.8

* Bump after public release

* Bump version, added changelog
2023-08-18 20:18:05 +03:00
Alex Root Junior
d0d0ff1be0
Update a warning message in dispatcher (#1269)
* Update a warning message in dispatcher

Enhanced the warning message in aiogram/dispatcher/dispatcher.py to include a JSON dump of the update. This change helps to give clearer and more detailed information on why an update type is unknown by including the specifics of what the update contains.

* Added changelog
2023-08-16 20:43:18 +03:00
nullmatawasoradesu
2093b45799
Fixed some typos in documentation (#1268)
* Fixed typo in i18n documentation

* Removed extra param in docstring of TelegramEventObserver's filter method

* Added changelog
2023-08-16 17:23:10 +03:00
Danipulok
16649ec896
Add error handling example (#1099)
* Add error handling example

* Add `ExceptionMessageFilter` usage

* Add `CHANGES`

* Update CHANGES/1099.doc.rst

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-08-14 23:43:44 +03:00
Alex Root Junior
8ff992bf1d
Content from global filters (#1267)
* Move global filters check placement into router to add chance to pass context from global filters into handlers in the same way as it possible in other places

* Added changelog
2023-08-14 22:18:11 +03:00
Alex Root Junior
577b44cdc1
Merge remote-tracking branch 'origin/dev-3.x' into dev-3.x 2023-08-14 01:34:30 +03:00
Alex Root Junior
3facba2730
Remove bad file 2023-08-14 01:34:24 +03:00
nullmatawasoradesu
0cec7d4933
Migration FAQ supplement (Finite State Machine) (#1264)
* Updated Migration FAQ > Finite State Machine

* Fixed typos, added changelog

* Fixed typo x2
2023-08-13 22:41:56 +03:00
Forden
4d12e073ee
Fix missing message content types (#1252)
* Fix missing message content types

* Added changelog

* Fix black

* Update CHANGES/1252.bugfix.rst

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>

* add tests

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-08-13 18:05:04 +03:00
Kostiantyn Kriuchkov
fac0a533b0
Examples/dev 3x multi file (#1254)
* Add multi-file bot example

This commit adds a multi-file bot example to the repository. .

* Refactor: Clean up code formatting for consistency

* add Changelog

* Refactor bot code, fix changelog version
2023-08-13 18:00:59 +03:00
nullmatawasoradesu
f87deea4fb
Added a section on Dependency Injection technology in documentation (#1253)
* Added a section on Dependency Injection technology in documentation

* Added changelog

* Edited comments & titles
2023-08-13 17:59:38 +03:00
Kostiantyn Kriuchkov
068875534b
Examples/dev 3x refactor fix* (#1261)
* Refactor and improve bot messages

Refactored bot code to use aiogram enumerations and enhanced chat messages with markdown beautifications for a more user-friendly display.

CommandStart() is now used instead of Command('start') for readability.

Furthermore, the bot's 'stop' command was improved, ensuring it executes appropriately during KeyboardInterrupt or SystemExit.

Additionally, the bot's logging was adjusted to output to sys.stdout for better logs' readability.

* Added Changelog

* Add guidance comments on obtaining bot tokens from environment variables

* Remove hardcoded tokens, opt for environment variable

* Remove unnecessary spaces and reorganize imports

* Fix error, switch default storage from Redis to Memory, and add logging to multibot example

* fix changelog version

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-08-13 17:56:32 +03:00
Alex Root Junior
a80031509e
Fixed nested hashtag, cashtag and email entnties parsing (#1263)
* Fixed nested hashtag, cashtag and email message entities not being parsed correctly when these entities are inside another entity.

* Tests coverage
2023-08-13 17:55:35 +03:00
Kostiantyn Kriuchkov
c516ea9d6a
Refactor and improve bot examples (#1256)
* Refactor and improve bot messages

Refactored bot code to use aiogram enumerations and enhanced chat messages with markdown beautifications for a more user-friendly display.

CommandStart() is now used instead of Command('start') for readability.

Furthermore, the bot's 'stop' command was improved, ensuring it executes appropriately during KeyboardInterrupt or SystemExit.

Additionally, the bot's logging was adjusted to output to sys.stdout for better logs' readability.

* Added Changelog

* Add guidance comments on obtaining bot tokens from environment variables

* Remove hardcoded tokens, opt for environment variable

* Remove unnecessary spaces and reorganize imports

* Fix error, switch default storage from Redis to Memory, and add logging to multibot example
2023-08-10 22:10:30 +03:00
nullmatawasoradesu
6d6bcd0a9b
Added a few words about skipping pending updates (#1251)
* Added a few words about skipping pending updates

* Added changelog

* Fixed typo
2023-08-07 23:54:05 +03:00
Alex Root Junior
649f76b5f6
Bump changelog 2023-08-06 19:31:10 +03:00
Alex Root Junior
f54ed1326b
Fixed typo 2023-08-06 19:31:08 +03:00
Alex Root Junior
c9f0b36ad6
Added support for message_thread_id in ChatActionSender (#1250)
* Add support for message_thread_id in ChatActionSender

The given changes add support for including the 'message_thread_id' in ChatActionSender function calls, allowing actions to be sent in specific threads rather than the main chat.

* Added changelog
2023-08-06 19:17:58 +03:00
Alex Root Junior
b311d59fce
Webhook docs (#1248)
* Added documentation for polling/webhook modes

* Added changelog

* Added changelog
2023-08-06 16:59:29 +03:00
Alex Root Junior
62d4b9014c
Fix bot instance passing in Dispatcher startup (#1247)
Modified the Dispatcher to remove the "bot" key from workflow_data if found, prior to emitting startup in order to allow manual addition of "bot" to workflow data. This change was necessary as a bot instance is required to start polling, and therefore must be passed correctly. This logic is now tested in the 'test_start_polling' function. The change also includes an update to the changelog.
2023-08-06 01:14:26 +03:00
Alex Root Junior
90654ac0fa
Enhance keyboard utility, improved documentation page. (#1236)
* Enhance keyboard utility, improved documentation for this utility.

Updated the 'aiogram/utils/keyboard.py' file with new methods for integrating buttons and keyboard creation more seamlessly. Added functionality to create buttons from existing markup and attach another builder. This improvement aims to make the keyboard building process more user-friendly and flexible.

* Added changelog

* Cover by tests
2023-08-04 22:36:50 +03:00
Alex Root Junior
11dc7eaa31
Added typehints for init methods of types and methods (#1245)
* Generate init

* Fixed mypy errors

* Bump butcher

* Added changelog
2023-08-04 00:30:27 +03:00
Alex Root Junior
aea876dfe0
Added codegen configuration for lost shortcuts (#1244)
* Added codegen configuration for lost shortcuts

* Rollback inline_message_id

* Added changelog
2023-08-02 23:28:50 +03:00
Yarik
d3bec413db
Add currency enum (#1194)
* Add currency enum

* Add change log

* Add butcher file

* Apply enum
2023-08-02 21:44:49 +03:00
Alex Root Junior
a7916c1103
Reworked InputFile sending (#1238)
* Reworked InputFile sending

* Added changelog
2023-08-02 21:41:07 +03:00
Alex Root Junior
53e5abbdee
Bump changelog 2023-07-30 20:51:29 +03:00
Alex Root Junior
faadc80460
Chat join request shortcuts (#1235)
* Add additional API message methods to ChatJoinRequest class

ChatJoinRequest now includes additional message methods including SendAnimation, SendAudio, SendContact, and many more. The changes are useful for sending various types of messages during chat join requests.

* Added changelog
2023-07-30 18:12:06 +03:00
Alex Root Junior
a1513ddb2d
Added shortcuts for ChatMemberUpdate event (#1234)
* Added shortcuts for ChatMemberUpdate event

* Added changelog
2023-07-30 17:29:45 +03:00
Alex Root Junior
98780dfb49
Added model validation to remove UNSET before field validation (#1233)
* Add model validation to remove UNSET before field validation

Updated aiogram/types/base.py to include a model validator which removes any 'UNSET' before field validation. This change was necessary to correctly handle `parse_mode` where 'UNSET' is used as a sentinel value. Without the removal of 'UNSET', it would create issues when passed to model initialization from `Bot.method_name`. 'UNSET' was also added to typing. Tiny documentation fix was made.

* Added changelog
2023-07-30 00:01:23 +03:00
Alex Root Junior
8ad0a1efb7
Ensure all message types are assigned to the correct bot. (#1232)
* Ensure all message types are assigned to the correct bot.

* Added changelog
2023-07-29 22:59:43 +03:00
Alex Root Junior
56f0d9d220
Migration guide 2.x -> 3.0 (#1143)
* Initial commit for docs cleanup

* Update migration guide

* More docs

* Added changes description

* Small fixes
2023-07-29 22:36:12 +03:00
Alex Root Junior
2ecf9cefd7
Removed the use of the context instance (Bot.get_current) from all placements that were used previously. (#1230)
* Removed the use of the context instance (Bot.get_current) from all placements that were used previously.

* Fixed tests

* Added changelog

* Change category
2023-07-28 22:23:32 +03:00
Alex Root Junior
ea0ecbcd50
Render changelog 2023-07-17 23:02:10 +03:00
Alex Root Junior
fcf9454e13
Merge branch 'Latand/dev-3.x' into dev-3.x 2023-07-17 03:11:32 +03:00
Alex Root Junior
6044a73e55
Small changes in the changelog 2023-07-17 02:56:35 +03:00
Alex Root Junior
710c7669c4
Bump magic-filter to 1.0.10 (#1221)
* Bump magic-filter to 1.0.10

* Added changelog

* Fixed compatibility
2023-07-17 02:48:27 +03:00
Alex Root Junior
31c11c31e0
Fixed subtypes and union types generation, new enums added (#1213)
* Fixed subtypes and union types generation, new enums added

* Added changes description
2023-07-11 23:39:54 +03:00
Alex Root Junior
a7b92bb050
PoC: Bot instance inside method shortcuts using pydantic Validation Context (#1210)
* PoC: Mount objects to the Bot instance, bind shortcuts to configured instance

* Fixe docstring of the bind method

* Pass Bot instance explicitly to the URLInputFile

* Added tests

* Added changelog

* Refactor aiogram client and update tests

Refactored base.py to improve code readability by separating response_type operation from model_validate(). Also, adjusted the parameters in URLInputFile() within test_input_file.py for better test coverage. Updated input_file.py to streamline read method and avoid unnecessary instantiation of Bot class. Lastly, adjusted typing in methods/base.py to enhance code clarity.

* Update changelog
2023-07-11 23:17:26 +03:00
Alex Root Junior
461e59bbdd
Update pydantic to V2 (#1202)
* Update pydantic, fix errors and warnings (all?)

* Fixed typehints

* Reformat code, removed unused imports

* Fixed typing extensions version compatibility

* Fixed coverage

* Describe changes

* Regen code
2023-07-02 15:07:19 +03:00