Exemple #1
0
 def __init__(
     self,
     token: Optional[str] = None,
     api: Optional[ABCAPI] = None,
     polling: Optional[ABCPolling] = None,
     loop: Optional[AbstractEventLoop] = None,
     loop_wrapper: Optional[LoopWrapper] = None,
     router: Optional["ABCRouter"] = None,
     labeler: Optional["ABCBotLabeler"] = None,
     error_handler: Optional["ABCErrorHandler"] = None,
 ):
     self.api: Union[ABCAPI, API] = API(
         token) if token is not None else api  # type: ignore
     self.error_handler = error_handler or ErrorHandler()
     self.loop_wrapper = loop_wrapper or LoopWrapper()
     self.labeler = labeler or BotLabeler()
     self.state_dispenser = BuiltinStateDispenser()
     self._polling = polling or BotPolling(self.api)
     self._router = router or BotRouter()
     self._loop = loop
Exemple #2
0
 def __init__(
     self,
     token: Optional["Token"] = None,
     api: Optional["ABCAPI"] = None,
     polling: Optional["ABCPolling"] = None,
     loop: Optional["AbstractEventLoop"] = None,
     loop_wrapper: Optional[LoopWrapper] = None,
     router: Optional["ABCRouter"] = None,
     labeler: Optional["ABCLabeler"] = None,
     state_dispenser: Optional["ABCStateDispenser"] = None,
     error_handler: Optional["ABCErrorHandler"] = None,
     task_each_event: bool = True,
 ):
     self.api: Union["ABCAPI", API] = API(token) if token is not None else api  # type: ignore
     self.error_handler = error_handler or ErrorHandler()
     self.loop_wrapper = loop_wrapper or LoopWrapper()
     self.labeler = labeler or UserLabeler()
     self.state_dispenser = state_dispenser or BuiltinStateDispenser()
     self._polling = polling or UserPolling(self.api)
     self._router = router or Router()
     self._loop = loop
     self.task_each_event = task_each_event