diff --git a/chatsky/messengers/common/interface.py b/chatsky/messengers/common/interface.py index 506e3f9fa..02510b2cd 100644 --- a/chatsky/messengers/common/interface.py +++ b/chatsky/messengers/common/interface.py @@ -28,8 +28,8 @@ class MessengerInterface(abc.ABC): It is responsible for connection between user and pipeline, as well as for request-response transactions. """ - def __init__(self, id: Optional[str] = None) -> None: - self.id = id if id is not None else type(self).__name__ + def __init__(self) -> None: + self.id = type(self).__name__ @abc.abstractmethod async def connect(self, pipeline_runner: PipelineRunnerFunction): @@ -63,8 +63,8 @@ class MessengerInterfaceWithAttachments(MessengerInterface, abc.ABC): Attachments not in this list will be neglected. """ - def __init__(self, id: Optional[str] = None, attachments_directory: Optional[Path] = None) -> None: - MessengerInterface.__init__(self, id) + def __init__(self, attachments_directory: Optional[Path] = None) -> None: + super().__init__() tempdir = gettempdir() if attachments_directory is not None and not str(attachments_directory.absolute()).startswith(tempdir): self.attachments_directory = attachments_directory @@ -173,8 +173,8 @@ class CallbackMessengerInterface(MessengerInterface): Callback message interface is waiting for user input and answers once it gets one. """ - def __init__(self, id: Optional[str] = None) -> None: - MessengerInterface.__init__(self, id) + def __init__(self) -> None: + super().__init__() self._pipeline_runner: Optional[PipelineRunnerFunction] = None async def connect(self, pipeline_runner: PipelineRunnerFunction): diff --git a/chatsky/messengers/console.py b/chatsky/messengers/console.py index 22458b821..b7d1beb1f 100644 --- a/chatsky/messengers/console.py +++ b/chatsky/messengers/console.py @@ -17,13 +17,12 @@ class CLIMessengerInterface(PollingMessengerInterface): def __init__( self, - id: Optional[str] = None, intro: Optional[str] = None, prompt_request: str = "request: ", prompt_response: str = "response: ", out_descriptor: Optional[TextIO] = None, ): - super().__init__(id) + super().__init__() self._ctx_id: Optional[Hashable] = None self._intro: Optional[str] = intro self._prompt_request: str = prompt_request diff --git a/chatsky/messengers/telegram/abstract.py b/chatsky/messengers/telegram/abstract.py index 840c492d4..410de0f91 100644 --- a/chatsky/messengers/telegram/abstract.py +++ b/chatsky/messengers/telegram/abstract.py @@ -88,8 +88,8 @@ class _AbstractTelegramInterface(MessengerInterfaceWithAttachments): MediaGroup, } - def __init__(self, token: str, id: Optional[str] = None, attachments_directory: Optional[Path] = None) -> None: - super().__init__(id, attachments_directory) + def __init__(self, token: str, attachments_directory: Optional[Path] = None) -> None: + super().__init__(attachments_directory) if not telegram_available: raise ImportError("`python-telegram-bot` package is missing.\nTry to run `pip install chatsky[telegram]`.") diff --git a/chatsky/messengers/telegram/interface.py b/chatsky/messengers/telegram/interface.py index fdba03ecb..9a7e27a00 100644 --- a/chatsky/messengers/telegram/interface.py +++ b/chatsky/messengers/telegram/interface.py @@ -31,12 +31,11 @@ class LongpollingInterface(_AbstractTelegramInterface): def __init__( self, token: str, - id: Optional[str] = None, attachments_directory: Optional[Path] = None, interval: int = 2, timeout: int = 20, ) -> None: - super().__init__(token, id, attachments_directory) + super().__init__(token, attachments_directory) self.interval = interval self.timeout = timeout @@ -61,12 +60,11 @@ class WebhookInterface(_AbstractTelegramInterface): def __init__( self, token: str, - id: Optional[str] = None, attachments_directory: Optional[Path] = None, host: str = "localhost", port: int = 844, ): - super().__init__(token, id, attachments_directory) + super().__init__(token, attachments_directory) self.listen = host self.port = port