mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Add possibility to choose a config file path
This commit is contained in:
parent
9e4c53f948
commit
6c5ab7ed8a
@ -118,6 +118,9 @@ class Client(Methods, BaseClient):
|
|||||||
workdir (``str``, *optional*):
|
workdir (``str``, *optional*):
|
||||||
Define a custom working directory. The working directory is the location in your filesystem
|
Define a custom working directory. The working directory is the location in your filesystem
|
||||||
where Pyrogram will store your session files. Defaults to "." (current directory).
|
where Pyrogram will store your session files. Defaults to "." (current directory).
|
||||||
|
|
||||||
|
config_file (``str``, *optional*):
|
||||||
|
Path of the configuration file. Defaults to ./config.ini
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
@ -133,7 +136,8 @@ class Client(Methods, BaseClient):
|
|||||||
first_name: str = None,
|
first_name: str = None,
|
||||||
last_name: str = None,
|
last_name: str = None,
|
||||||
workers: int = 4,
|
workers: int = 4,
|
||||||
workdir: str = "."):
|
workdir: str = ".",
|
||||||
|
config_file: str = "./config.ini"):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.session_name = session_name
|
self.session_name = session_name
|
||||||
@ -149,6 +153,7 @@ class Client(Methods, BaseClient):
|
|||||||
self.last_name = last_name
|
self.last_name = last_name
|
||||||
self.workers = workers
|
self.workers = workers
|
||||||
self.workdir = workdir
|
self.workdir = workdir
|
||||||
|
self.config_file = config_file
|
||||||
|
|
||||||
self.dispatcher = Dispatcher(self, workers)
|
self.dispatcher = Dispatcher(self, workers)
|
||||||
|
|
||||||
@ -806,7 +811,7 @@ class Client(Methods, BaseClient):
|
|||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read("config.ini")
|
parser.read(self.config_file)
|
||||||
|
|
||||||
if self.api_id and self.api_hash:
|
if self.api_id and self.api_hash:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user