ارور من اینه

(myenv) root@xuquo7ti:~# python3 main.py
PyTgCalls v2.0.6 powered by NTgCalls v1.2.3, Copyright (C) 2021-2024 Laky-64 <https://github.com/Laky-64>
Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

Telegram says: [400 MESSAGE_TOO_LONG] - The message text is too long (caused by "messages.EditMessage")
Traceback (most recent call last):
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/client.py", line 920, in get_file
    await func()
  File "/root/main.py", line 57, in progress_callback
    await msg.edit(f"Downloading video: {current:.2f}% completed.\n{'#'*level_downloaded if level_downloaded != 0 else ''}{'.'*level_not_downloaded if level_not_downloaded != 0 else ''}")
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/types/messages_and_media/message.py", line 2803, in edit_text
    return await self._client.edit_message_text(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/methods/messages/edit_message_text.py", line 82, in edit_message_text
    r = await self.invoke(
        ^^^^^^^^^^^^^^^^^^
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/methods/advanced/invoke.py", line 79, in invoke
    r = await self.session.invoke(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/session/session.py", line 389, in invoke
    return await self.send(query, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/session/session.py", line 357, in send
    RPCError.raise_it(result, type(data))
  File "/root/myenv/lib/python3.12/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it
    raise getattr(
pyrogram.errors.exceptions.bad_request_400.MessageTooLong: Telegram says: [400 MESSAGE_TOO_LONG] - The message text is too long (caused by "messages.EditMessage")

کد من اینه

from pyrogram import Client # pip install pyrogram
from pyrogram import filters # pip install tgcrypto
from pyrogram.types import Message

from pytgcalls import filters as fl # pip install py-tgcalls -U
from pytgcalls import idle
from pytgcalls import PyTgCalls
from pytgcalls.types import ChatUpdate
from pytgcalls.types import GroupCallParticipant
from pytgcalls.types import MediaStream
from pytgcalls.types import Update

import os
import re
import subprocess
import random
import string
from time import sleep

api_id = 13315602
api_hash = "21dc35844ae3c0e31faacc8f0ade17db"

proxy = {
    "scheme": "socks5",  # "socks4", "socks5" and "http" are supported
    "hostname": "127.0.0.1",
    "port": 2080,
    "username": "username",
    "password": "password"
}

phone_num = '+989115050944'

app = Client(
    "app_sesion",
    api_id=api_id,
    api_hash=api_hash,
    phone_number=phone_num,
    # proxy=proxy
)

call_py = PyTgCalls(app)

def generate_random_string(length=10):
    # ترکیب حروف کوچک، بزرگ و اعداد
    characters = string.ascii_letters + string.digits
    # ایجاد یک رشته رندوم از ترکیب حروف و اعداد
    random_string = ''.join(random.choice(characters) for _ in range(length))
    return random_string

perv_perc = -1

async def progress_callback(current, total, msg):
    global perv_perc
    if current != perv_perc and current > perv_perc:
        level_downloaded = int(current // 5)
        level_not_downloaded = 20 - level_downloaded
        await msg.edit(f"Downloading video: {current:.2f}% completed.\n{'#'*level_downloaded if level_downloaded != 0 else ''}{'.'*level_not_downloaded if level_not_downloaded != 0 else ''}")
        perv_perc = current

async def download_video(url: str, update_msg: Message) -> str:
    output_file = f'video_{generate_random_string()}.mp4'  # نام فایل خروجی با زمان منحصر به فرد
    try:
        # فراخوانی yt-dlp
        process = subprocess.Popen(
            ['yt-dlp', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]', '-o', output_file, url],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )

        current_size = 0
        total_size = 0

        while True:
            output = process.stdout.readline()
            if output == '' and process.poll() is not None:
                break
            
            if output:

                # درصد دانلود را از خروجی استخراج کنید
                if re.search(r"download",output) and re.search(r'\d+.\d+%', output):

                    percent_ = re.findall(r'\d+.\d+%',output)[0].replace("%","")

                    current_size = float(percent_)

                    # با استفاده از تابع progress_callback درصد را به کاربر ارسال کنید
                    await progress_callback(current_size, 100, update_msg)  # فرض بر اینکه دانلود 100 درصدی است
            sleep(0.5)
        # بررسی خطا
        stderr_output = process.stderr.read()
        if stderr_output:
            print("Error:", stderr_output)

        return output_file
    except subprocess.CalledProcessError as e:
        print(f"Error: {e}")
        return None

@app.on_message(filters.private & filters.text)
async def handle_link(client: Client, update: Message):
    url = update.text
    progress_msg = await update.reply_text("Download Started. Please Wait...")
    # فراخوانی تابع دانلود به صورت همزمان
    video_file = await download_video(url, progress_msg)

    if video_file and os.path.exists(video_file):
        await client.send_video(update.chat.id, video_file)
        os.remove(video_file)  # حذف فایل بعد از ارسال
    else:
        await update.reply_text('خطا در دانلود ویدیو.')

@app.on_message(filters.private & filters.document)
async def play_handler(_, message: Message):
    if message.chat.id == 7618452400:
        file_name = message.document.file_name
        index_format = file_name.rfind('.')
        progress_msg = await message.reply("Download Started. Please Waite...")
        if re.search(r"mp3", file_name):
            await app.download_media(message, f"{file_name[:index_format]}.mp3", progress=progress_callback, progress_args=(progress_msg, file_name))
        elif re.search(r"mp4|mkv", file_name):
            await app.download_media(message, f"{file_name[:index_format]}.mkv", progress=progress_callback, progress_args=(progress_msg, file_name))

@app.on_message(filters.private & filters.audio)
async def play_handler(_, message: Message):
    if message.chat.id == 7618452400:
        file_name = message.audio.file_name
        index_format = file_name.rfind('.')
        progress_msg = await message.reply("Download Started. Please Waite...")
        await app.download_media(message, f"{file_name[:index_format]}.mp3", progress=progress_callback, progress_args=(progress_msg, file_name))

@app.on_message(filters.private & filters.video)
async def play_handler(_, message: Message):
    if message.chat.id == 7618452400:
        file_name = message.video.file_name
        index_format = file_name.rfind('.')
        progress_msg = await message.reply("Download Started. Please Waite...")
        await app.download_media(message, f"{file_name[:index_format]}.mkv", progress=progress_callback, progress_args=(progress_msg, file_name))

@app.on_message(filters.regex('/help'))
async def play_handler(_: Client, message: Message):
    files = os.listdir("./downloads")
    song_name = "لیست اهنگ ها به شرح زیر است\n"
    film_name = "لیست فیلم ها به شرح زیر است\n"
    for name in files:
        if re.search(r"mp3",name):
            song_name += name.replace(".mp3","") + "\n"
        if re.search(r"mkv",name):
            film_name += name.replace(".mkv","") + "\n"
    text = """شما با فعال کردن تماس گروه میتونین از دستور زیر استفاده کرده تا اهنگ مد نظر رو اجرا یا کنترل کنین همچنین در انتهای لیست نام اهنگ های فعلی موجود ذکر شده
/play برای اجرای اهنگ مد نظر
به طور مثال
/play Qrargah
/stop برای متوقف کردن
/pause برای استپ کردن
/resume اجرای ادامه
/change_volume برای تغییر ولوم
به طور مثال
/change_volume 50
""" + song_name + film_name
    await app.send_message(message.chat.id, text)

@app.on_message(filters.regex('/del'))
async def play_handler(_: Client, message: Message):
    text = message.text

    if re.search(r"film",text):
        file_name = text.replace("/del film ","")+".mkv"
    elif re.search(r"music",text):
        file_name = text.replace("/del music ","")+".mp4"
    
    os.remove(f"./downloads/{file_name}")
    
    await app.send_message(message.chat.id, f"remove successfull {file_name}")

@app.on_message(filters.regex('/play'))
async def play_handler(_: Client, message: Message):
    text = message.text
    if re.search(r"music",text):
        song_name = text.replace("/play music ","")
        test_stream = f'./downloads/{song_name}.mp3'
    if re.search(r"film",text):
        film_name = text.replace("/play film ","")
        test_stream = f'./downloads/{film_name}.mkv'
    await call_py.play(
        message.chat.id,
        MediaStream(
            test_stream,
        ),
    )
    await app.send_message(message.chat.id, f"Bot Play {song_name}")
   
@app.on_message(filters.regex('/cache'))
async def cache_handler(_: Client, _m: Message):
    await app.send_message(_m.chat.id, call_py.cache_peer)

@app.on_message(filters.regex('/ping'))
async def ping_handler(_: Client, _m: Message):
    await app.send_message(_m.chat.id, call_py.ping)

@app.on_message(filters.regex('/pause'))
async def pause_handler(_: Client, message: Message):
    await call_py.pause_stream(
        message.chat.id,
    )
    await app.send_message(message.chat.id, "Bot Pause/")

@app.on_message(filters.regex('/resume'))
async def resume_handler(_: Client, message: Message):
    await call_py.resume_stream(
        message.chat.id,
    )
    await app.send_message(message.chat.id, "Bot Resume/")

@app.on_message(filters.regex('/stop'))
async def stop_handler(_: Client, message: Message):
    await call_py.leave_call(
        message.chat.id,
    )
    await app.send_message(message.chat.id, "Bot Stop/")

@app.on_message(filters.regex('/change_volume'))
async def change_volume_handler(_: Client, message: Message):
    volume = int(message.text.replace("/change_volume ",""))
    await call_py.change_volume_call(
        message.chat.id,
        volume,
    )

@app.on_message(filters.regex('/status'))
async def get_play_status(client: Client, message: Message):
    await client.send_message(
        message.chat.id,
        f'Current seconds {await call_py.played_time(message.chat.id)}',
    )


@call_py.on_update(
    fl.chat_update(
        ChatUpdate.Status.KICKED | ChatUpdate.Status.LEFT_GROUP,
    ),
)
async def kicked_handler(_: PyTgCalls, update: Update):
    print(f'Kicked from {update.chat_id} or left')


@call_py.on_update(fl.stream_end)
async def stream_end_handler(_: PyTgCalls, update: Update):
    print(f'Stream ended in {update.chat_id}', update)


@call_py.on_update(
    fl.call_participant(GroupCallParticipant.Action.JOINED),
)
async def participant_handler(_: PyTgCalls, update: Update):
    print(f'Participant joined in {update.chat_id}', update)


@call_py.on_update()
async def all_updates(_: PyTgCalls, update: Update):
    print(update)


call_py.start()
idle()