|
|
@@ -22,9 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
SOFTWARE.
|
|
|
"""
|
|
|
-print("[INFO]: INITIALIZING")
|
|
|
import asyncio
|
|
|
-import logging
|
|
|
import time
|
|
|
from inspect import getfullargspec
|
|
|
from os import path
|
|
|
@@ -36,22 +34,6 @@ from pyrogram.types import Message
|
|
|
from pyromod import listen
|
|
|
from Python_ARQ import ARQ
|
|
|
|
|
|
-# Setup logging
|
|
|
-log_file = "error.log"
|
|
|
-
|
|
|
-with open(log_file, "w") as f:
|
|
|
- f.write("PEAK OF LOG FILE")
|
|
|
-logging.basicConfig(
|
|
|
- level=logging.ERROR,
|
|
|
- format="[%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s %(levelname)s: %(message)s",
|
|
|
- datefmt="%m-%d %H:%M",
|
|
|
- filename=log_file,
|
|
|
- filemode="w",
|
|
|
-)
|
|
|
-console = logging.StreamHandler()
|
|
|
-logging.getLogger("").addHandler(console)
|
|
|
-log = logging.getLogger()
|
|
|
-
|
|
|
is_config = path.exists("config.py")
|
|
|
|
|
|
if is_config:
|
|
|
@@ -97,7 +79,6 @@ loop = asyncio.get_event_loop()
|
|
|
loop.run_until_complete(load_sudoers())
|
|
|
|
|
|
if not HEROKU:
|
|
|
- print("[INFO]: INITIALIZING USERBOT CLIENT")
|
|
|
app2 = Client(
|
|
|
"userbot",
|
|
|
phone_number=PHONE_NUMBER,
|
|
|
@@ -105,73 +86,39 @@ if not HEROKU:
|
|
|
api_hash=API_HASH,
|
|
|
)
|
|
|
else:
|
|
|
- print("[INFO]: INITIALIZING USERBOT CLIENT")
|
|
|
app2 = Client(SESSION_STRING, api_id=API_ID, api_hash=API_HASH)
|
|
|
|
|
|
-# Aiohttp Client
|
|
|
-print("[INFO]: INITIALZING AIOHTTP SESSION")
|
|
|
aiohttpsession = ClientSession()
|
|
|
-# ARQ Client
|
|
|
-print("[INFO]: INITIALIZING ARQ CLIENT")
|
|
|
+
|
|
|
arq = ARQ(ARQ_API_URL, ARQ_API_KEY, aiohttpsession)
|
|
|
-# Bot client
|
|
|
-print("[INFO]: INITIALIZING BOT CLIENT")
|
|
|
+
|
|
|
app = Client(
|
|
|
"wbb", bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH
|
|
|
)
|
|
|
|
|
|
+print("[INFO]: STARTING BOT CLIENT")
|
|
|
+app.start()
|
|
|
+print("[INFO]: STARTING USERBOT CLIENT")
|
|
|
+app2.start()
|
|
|
|
|
|
-BOT_ID = 0
|
|
|
-BOT_NAME = ""
|
|
|
-BOT_USERNAME = ""
|
|
|
-BOT_MENTION = ""
|
|
|
-BOT_DC_ID = 0
|
|
|
-USERBOT_ID = 0
|
|
|
-USERBOT_NAME = ""
|
|
|
-USERBOT_USERNAME = ""
|
|
|
-USERBOT_DC_ID = 0
|
|
|
-USERBOT_MENTION = ""
|
|
|
-USERBOT_BOT_CHAT_COMMON = []
|
|
|
-
|
|
|
-
|
|
|
-def get_info(app, app2):
|
|
|
- global BOT_ID, BOT_NAME, BOT_USERNAME, BOT_DC_ID, BOT_MENTION
|
|
|
- global USERBOT_ID, USERBOT_NAME, USERBOT_USERNAME, USERBOT_DC_ID, USERBOT_MENTION
|
|
|
- global USERBOT_BOT_CHAT_COMMON
|
|
|
- getme = app.get_me()
|
|
|
- getme2 = app2.get_me()
|
|
|
- BOT_ID = getme.id
|
|
|
- USERBOT_ID = getme2.id
|
|
|
- BOT_NAME = (
|
|
|
- f"{getme.first_name} {getme.last_name}"
|
|
|
- if getme.last_name
|
|
|
- else getme.first_name
|
|
|
- )
|
|
|
- BOT_USERNAME = getme.username
|
|
|
- BOT_MENTION = getme.mention
|
|
|
- BOT_DC_ID = getme.dc_id
|
|
|
-
|
|
|
- USERBOT_NAME = (
|
|
|
- f"{getme2.first_name} {getme2.last_name}"
|
|
|
- if getme2.last_name
|
|
|
- else getme2.first_name
|
|
|
- )
|
|
|
- USERBOT_USERNAME = getme2.username
|
|
|
- USERBOT_MENTION = getme2.mention
|
|
|
- USERBOT_DC_ID = getme2.dc_id
|
|
|
+print("[INFO]: GATHERING PROFILE INFO")
|
|
|
+x = app.get_me()
|
|
|
+y = app2.get_me()
|
|
|
|
|
|
+BOT_ID = x.id
|
|
|
+BOT_NAME = x.first_name + (x.last_name or "")
|
|
|
+BOT_USERNAME = x.username
|
|
|
+BOT_MENTION = x.mention
|
|
|
+BOT_DC_ID = x.dc_id
|
|
|
+
|
|
|
+USERBOT_ID = y.id
|
|
|
+USERBOT_NAME = y.first_name + (y.last_name or "")
|
|
|
+USERBOT_USERNAME = y.username
|
|
|
+USERBOT_MENTION = y.mention
|
|
|
+USERBOT_DC_ID = y.dc_id
|
|
|
|
|
|
-print("[INFO]: STARTING BOT CLIENT TEMPORARILY")
|
|
|
-app.start()
|
|
|
-print("[INFO]: STARTING USERBOT CLIENT TEMPORARILY")
|
|
|
-app2.start()
|
|
|
-print("[INFO]: LOADING UB/BOT PROFILE INFO")
|
|
|
-get_info(app, app2)
|
|
|
-print("[INFO]: LOADED UB/BOT PROFILE INFO")
|
|
|
if USERBOT_ID not in SUDOERS:
|
|
|
SUDOERS.append(USERBOT_ID)
|
|
|
-app.stop()
|
|
|
-app2.stop()
|
|
|
|
|
|
|
|
|
async def eor(msg: Message, **kwargs):
|