diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index b19bb486..2d1e211e 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -169,7 +169,7 @@ class Client(Methods, BaseClient): workers: int = BaseClient.WORKERS, workdir: str = BaseClient.WORKDIR, config_file: str = BaseClient.CONFIG_FILE, - plugins_dir: str or None = BaseClient.PLUGINS_DIR): + plugins_dir: str = None): super().__init__() self.session_name = session_name @@ -983,10 +983,7 @@ class Client(Methods, BaseClient): try: dirs = os.listdir(self.plugins_dir) except FileNotFoundError: - if self.plugins_dir == Client.PLUGINS_DIR: - log.info("No plugin loaded: default directory is missing") - else: - log.warning('No plugin loaded: "{}" directory is missing'.format(self.plugins_dir)) + log.warning('No plugin loaded: "{}" directory is missing'.format(self.plugins_dir)) else: plugins_dir = self.plugins_dir.lstrip("./").replace("/", ".") plugins_count = 0 @@ -1010,11 +1007,14 @@ class Client(Methods, BaseClient): except Exception: pass - log.warning('Successfully loaded {} plugin{} from "{}"'.format( - plugins_count, - "s" if plugins_count > 1 else "", - self.plugins_dir - )) + if plugins_count > 0: + log.warning('Successfully loaded {} plugin{} from "{}"'.format( + plugins_count, + "s" if plugins_count > 1 else "", + self.plugins_dir + )) + else: + log.warning('No plugin loaded: "{}" doesn\'t contain any valid plugin'.format(self.plugins_dir)) def save_session(self): auth_key = base64.b64encode(self.auth_key).decode() diff --git a/pyrogram/client/ext/base_client.py b/pyrogram/client/ext/base_client.py index 5801b4e8..c18c4050 100644 --- a/pyrogram/client/ext/base_client.py +++ b/pyrogram/client/ext/base_client.py @@ -52,7 +52,6 @@ class BaseClient: WORKERS = 4 WORKDIR = "." CONFIG_FILE = "./config.ini" - PLUGINS_DIR = "./plugins" MEDIA_TYPE_ID = { 0: "thumbnail",