|
7 | 7 | from main.plugins.helpers import screenshot
|
8 | 8 |
|
9 | 9 | from pyrogram import Client, filters
|
10 |
| -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid |
| 10 | +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, PeerIdInvalid |
11 | 11 | from pyrogram.enums import MessageMediaType
|
12 | 12 | from ethon.pyfunc import video_metadata
|
13 | 13 | from ethon.telefunc import fast_upload
|
@@ -146,10 +146,10 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i):
|
146 | 146 | await client.edit_message_text(sender, edit_id, "Have you joined the channel?")
|
147 | 147 | return
|
148 | 148 | except PeerIdInvalid:
|
149 |
| - chat = int(msg_link.split("/")[-3]) |
150 |
| - new_link = f"t.me/c/{chat}/{msg_id}" |
| 149 | + chat = msg_link.split("/")[-3] |
151 | 150 | try:
|
152 | 151 | int(chat)
|
| 152 | + new_link = f"t.me/c/{chat}/{msg_id}" |
153 | 153 | except ValueError:
|
154 | 154 | new_link = f"t.me/b/{chat}/{msg_id}"
|
155 | 155 | return await get_msg(userbot, client, bot, sender, to, edit_id, new_link, i)
|
@@ -199,7 +199,7 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i):
|
199 | 199 | await edit.delete()
|
200 | 200 | else:
|
201 | 201 | edit = await client.edit_message_text(sender, edit_id, "Cloning.")
|
202 |
| - chat = msg_link.split("/")[-2] |
| 202 | + chat = msg_link.split("t.me")[1].split("/")[1] |
203 | 203 | try:
|
204 | 204 | msg = await client.copy_message(sender, chat, msg_id)
|
205 | 205 | if msg.empty:
|
|
0 commit comments