Skip to content

Commit

Permalink
pyrofork: Ignore excluded plugins [2/2]
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Sep 20, 2024
1 parent 82b9a9a commit 174e94a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyrogram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,12 @@ async def load_session(self):
except Exception as e:
print(e)

def is_excluded(self, exclude, module):
for e in exclude:
if module == e or module.startswith(e + '.'):
return True
return False

def load_plugins(self):
if self.plugins:
plugins = self.plugins.copy()
Expand Down Expand Up @@ -952,7 +958,7 @@ def load_plugins(self):
else:
for path, handlers in include:
module_path = root.replace("/", ".") + "." + path
if module_path in exclude_plugins:
if self.is_excluded(exclude_plugins, module_path):
log.warning(
'[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path
)
Expand Down

0 comments on commit 174e94a

Please sign in to comment.