diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index 484dd973..b80448c9 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -180,7 +180,7 @@ class CommandStart(Command): return {'deep_link': match} return False - return False + return check class CommandHelp(Command): diff --git a/aiogram/utils/callback_data.py b/aiogram/utils/callback_data.py index b0162a7e..e24ad7b1 100644 --- a/aiogram/utils/callback_data.py +++ b/aiogram/utils/callback_data.py @@ -75,7 +75,7 @@ class CallbackData: raise TypeError('Too many arguments were passed!') callback_data = self.sep.join(data) - if len(callback_data) > 64: + if len(callback_data.encode()) > 64: raise ValueError('Resulted callback data is too long!') return callback_data diff --git a/aiogram/utils/deprecated.py b/aiogram/utils/deprecated.py index 5232e8a3..83a9034c 100644 --- a/aiogram/utils/deprecated.py +++ b/aiogram/utils/deprecated.py @@ -102,14 +102,18 @@ def renamed_argument(old_name: str, new_name: str, until_version: str, stackleve is_coroutine = asyncio.iscoroutinefunction(func) def _handling(kwargs): + """ + Returns updated version of kwargs. + """ routine_type = 'coroutine' if is_coroutine else 'function' if old_name in kwargs: warn_deprecated(f"In {routine_type} '{func.__name__}' argument '{old_name}' " f"is renamed to '{new_name}' " f"and will be removed in aiogram {until_version}", stacklevel=stacklevel) + kwargs = kwargs.copy() kwargs.update({new_name: kwargs.pop(old_name)}) - return kwargs + return kwargs if is_coroutine: @functools.wraps(func) diff --git a/tests/test_filters.py b/tests/test_filters.py index 0592f31b..f29e1982 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -276,7 +276,7 @@ class TestCommandStart: test_filter = CommandStart() # empty filter message = Message(text=self.START) result = await test_filter.check(message) - assert result == {'deep_link': None} + assert result async def test_start_command_payload_is_matched(self): test_filter = CommandStart(deep_link=self.GOOD)