Skip to content

Commit 9ed5fb7

Browse files
authored
Update pyroplug.py
Error vasusen-code#158 *quick-and-dirty*-fix
1 parent 1671e47 commit 9ed5fb7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

main/plugins/pyroplug.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,25 @@ def thumbnail(sender):
1919
return f'{sender}.jpg'
2020
else:
2121
return None
22-
22+
23+
# ------------------------------------
24+
# Fix: Error: Peer id invalid
25+
import pyrogram.utils as utils
26+
27+
28+
def get_peer_type(peer_id: int) -> str:
29+
print('get_peer_type call')
30+
peer_id_str = str(peer_id)
31+
if not peer_id_str.startswith("-"):
32+
return "user"
33+
elif peer_id_str.startswith("-100"):
34+
return "channel"
35+
else:
36+
return "chat"
37+
38+
utils.get_peer_type = get_peer_type
39+
# ------------------------------------
40+
2341
async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i):
2442

2543
""" userbot: PyrogramUserBot

0 commit comments

Comments
 (0)