diff --git a/aiogram/contrib/fsm_storage/redis.py b/aiogram/contrib/fsm_storage/redis.py index e3103ae3..eaaf3985 100644 --- a/aiogram/contrib/fsm_storage/redis.py +++ b/aiogram/contrib/fsm_storage/redis.py @@ -303,6 +303,8 @@ class RedisStorage2(BaseStorage): async def update_data(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None, data: typing.Dict = None, **kwargs): + if data is None: + data = {} temp_data = await self.get_data(chat=chat, user=user, default={}) temp_data.update(data, **kwargs) await self.set_data(chat=chat, user=user, data=temp_data) @@ -330,6 +332,8 @@ class RedisStorage2(BaseStorage): async def update_bucket(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None, bucket: typing.Dict = None, **kwargs): + if bucket is None: + bucket = {} temp_bucket = await self.get_data(chat=chat, user=user) temp_bucket.update(bucket, **kwargs) await self.set_data(chat=chat, user=user, data=temp_bucket) diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index 91c5fc61..170e86b4 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -133,6 +133,7 @@ class StateFilter(BaseFilter): result = super(StateFilter, cls).validate(full_config) if not result: return {cls.key: None} + return result async def check(self, obj): if '*' in self.state: diff --git a/aiogram/dispatcher/filters/filters.py b/aiogram/dispatcher/filters/filters.py index c0ffcf57..64f0753d 100644 --- a/aiogram/dispatcher/filters/filters.py +++ b/aiogram/dispatcher/filters/filters.py @@ -88,7 +88,7 @@ class FilterRecord: if self.event_handlers: return event_handler in self.event_handlers elif self.exclude_event_handlers: - return not event_handler in self.exclude_event_handlers + return event_handler not in self.exclude_event_handlers return True diff --git a/examples/finite_state_machine_example.py b/examples/finite_state_machine_example.py index e9a25ef2..45755d9a 100644 --- a/examples/finite_state_machine_example.py +++ b/examples/finite_state_machine_example.py @@ -122,10 +122,5 @@ async def process_gender(message: types.Message): await state.finish() -async def shutdown(dispatcher: Dispatcher): - await dispatcher.storage.close() - await dispatcher.storage.wait_closed() - - if __name__ == '__main__': - executor.start_polling(dp, loop=loop, skip_updates=True, on_shutdown=shutdown) + executor.start_polling(dp, loop=loop, skip_updates=True)