1010import contextlib
1111import json
1212import logging
13- import os
14- import psutil
15- import threading
1613import random
1714import re
1815import tempfile
16+ import threading
1917import time
2018import traceback
2119from io import BytesIO
2220from typing import Any
2321
22+ import psutil
2423import pyrogram .errors
2524import qrcode
2625import yt_dlp
2928from pyrogram .errors .exceptions .bad_request_400 import UserNotParticipant
3029from pyrogram .raw import functions
3130from pyrogram .raw import types as raw_types
32- from tgbot_ping import get_runtime
3331from youtubesearchpython import VideosSearch
3432
3533from channel import Channel
6967 clean_tempfile ,
7068 customize_logger ,
7169 get_revision ,
72- extract_url_and_name
70+ extract_url_and_name ,
7371)
7472
7573logging .info ("Authorized users are %s" , AUTHORIZED_USER )
@@ -216,6 +214,7 @@ def ping_handler(client: Client, message: types.Message):
216214 chat_id = message .chat .id
217215 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
218216 message_sent = False
217+
219218 def send_message_and_measure_ping ():
220219 start_time = int (round (time .time () * 1000 ))
221220 reply = client .send_message (chat_id , "Starting Ping..." )
@@ -355,6 +354,8 @@ def settings_handler(client: Client, message: types.Message):
355354
356355@app .on_message (filters .command (["buy" ]))
357356def buy_handler (client : Client , message : types .Message ):
357+ return client .send_message (message .chat .id , "This feature will comback soon..." )
358+
358359 # process as chat.id, not from_user.id
359360 chat_id = message .chat .id
360361 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
@@ -500,7 +501,7 @@ def spdl_handler(client: Client, message: types.Message):
500501 redis = Redis ()
501502 chat_id = message .from_user .id
502503 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
503- message_text = message .text
504+ message_text = message .text
504505 url , new_name = extract_url_and_name (message_text )
505506 logging .info ("spdl start %s" , url )
506507 if url is None or not re .findall (r"^https?://" , url .lower ()):
@@ -518,7 +519,7 @@ def direct_handler(client: Client, message: types.Message):
518519 redis = Redis ()
519520 chat_id = message .from_user .id
520521 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
521- message_text = message .text
522+ message_text = message .text
522523 url , new_name = extract_url_and_name (message_text )
523524 logging .info ("direct start %s" , url )
524525 if url is None or not re .findall (r"^https?://" , url .lower ()):
@@ -539,7 +540,7 @@ def leech_handler(client: Client, message: types.Message):
539540 redis = Redis ()
540541 chat_id = message .from_user .id
541542 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
542- message_text = message .text
543+ message_text = message .text
543544 url , new_name = extract_url_and_name (message_text )
544545 logging .info ("leech using aria2 start %s" , url )
545546 if url is None or not re .findall (r"^https?://" , url .lower ()):
@@ -557,7 +558,7 @@ def ytdl_handler(client: Client, message: types.Message):
557558 redis = Redis ()
558559 chat_id = message .from_user .id
559560 client .send_chat_action (chat_id , enums .ChatAction .TYPING )
560- message_text = message .text
561+ message_text = message .text
561562 url , new_name = extract_url_and_name (message_text )
562563 logging .info ("ytdl start %s" , url )
563564 if url is None or not re .findall (r"^https?://" , url .lower ()):
0 commit comments