From cb755faa9a403a61e783545e0159e3cbefc1ce53 Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 26 Jun 2023 13:29:26 +0200 Subject: [PATCH] Added scopes_placeholders --- libbot/pyrogram/classes/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libbot/pyrogram/classes/client.py b/libbot/pyrogram/classes/client.py index cd0cf5b..7b2b029 100644 --- a/libbot/pyrogram/classes/client.py +++ b/libbot/pyrogram/classes/client.py @@ -3,7 +3,7 @@ from datetime import datetime, timedelta from os import cpu_count, getpid from pathlib import Path from time import time -from typing import List, Union +from typing import Dict, List, Union try: import pyrogram @@ -80,6 +80,8 @@ class PyroClient(Client): self.scheduler: Union[AsyncIOScheduler, BackgroundScheduler, None] = scheduler + self.scopes_placeholders: Dict[str, int] = {"owner": self.owner} + async def start(self): await super().start() @@ -164,8 +166,9 @@ class PyroClient(Client): scope_dict = loads(scope) # Replace "owner" in the bot scope with owner's id - if "chat_id" in scope_dict and scope_dict["chat_id"] == "owner": - scope_dict["chat_id"] = self.owner + for placeholder, chat_id in self.scopes_placeholders.items(): + if "chat_id" in scope_dict and scope_dict["chat_id"] == placeholder: + scope_dict["chat_id"] = chat_id # Create object with the same name and args from the dict try: