def __init__( self, state_storage: StateStorage, storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None, ) -> None: self._state_storage = state_storage self._storage = storage or redis.RedisStorage(StorageSettings()) self._default_state_name = default_state_name or "home"
def install( self, *, storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None ) -> None: storage = storage or redis.RedisStorage(StorageSettings()) self.container.add_constant(BaseStorage, storage) self.container.add_constant(Dispatcher, self.dispatcher) self.container.add_constant(Bot, self.dispatcher.bot) logger.info(f"Install AiogramMainRouter") logger.debug(f"install, storage{storage}, default_state_name={default_state_name}") AiogramEventProcessor.install(self.dispatcher, self._state_storage, self.container, storage, default_state_name)
def __init__( self, state_storage: StateStorage, container: BaseContainer, state_data_storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None, ) -> None: self._state_storage = state_storage self._state_data_storage = state_data_storage or redis.RedisStorage(StorageSettings()) self._default_state_name = default_state_name or "home" self._container = container super().__init__()
def install(self, *, storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None) -> None: logger.info(f"install AiogramMainRouter") storage = storage or redis.RedisStorage(StorageSettings()) self.container.add_constant(BaseStorage, storage) for class_, instance in self.inject_values.items(): self.container.add_constant(class_, instance) AiogramEventProcessor.install(self.dp, self._state_storage, self.container, storage, default_state_name)
def install(self, *, storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None) -> None: logger.info(f"Install VkWaveMainRouter") logger.debug( f"install, storage={storage}, default_state_name={default_state_name}" ) self._default_state_name = default_state_name or "home" self._storage = storage or redis.RedisStorage(StorageSettings()) self.container.bind_constant(BaseStorage, self._storage) self.container.bind_constant(SimpleLongPollBot, self.bot) VkWaveEventProcessor.install(self.bot, self._state_storage, storage, default_state_name)
def install(self, *, storage: Optional[BaseStorage] = None, default_state_name: Optional[str] = None) -> None: storage = storage or redis.RedisStorage(StorageSettings()) self.container.bind_constant(BaseStorage, storage) for class_, instance in self.inject_values.items(): self.container.bind_constant(class_, instance) if self.mode == Frameworks.AIOGRAM: logger.info(f"Install AiogramMainRouter") from state_manager.event_processors.aiogram import AiogramEventProcessor AiogramEventProcessor.install(self.dp, self._state_storage, storage, default_state_name) elif self.mode == Frameworks.VKWAVE: from state_manager.event_processors.vkwave import VkWaveEventProcessor VkWaveEventProcessor.install(self.bot, self._state_storage, storage, default_state_name)