mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Make plugins disabled by default
Users need to explicitly set plugins_dir parameter
This commit is contained in:
parent
077e7c00d5
commit
1fe46610cd
@ -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()
|
||||
|
@ -52,7 +52,6 @@ class BaseClient:
|
||||
WORKERS = 4
|
||||
WORKDIR = "."
|
||||
CONFIG_FILE = "./config.ini"
|
||||
PLUGINS_DIR = "./plugins"
|
||||
|
||||
MEDIA_TYPE_ID = {
|
||||
0: "thumbnail",
|
||||
|
Loading…
Reference in New Issue
Block a user