fixed can't join chat

This commit is contained in:
levina 2022-01-20 21:23:52 +07:00 committed by GitHub
parent 1db61758ad
commit f8b990e624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,16 +100,15 @@ async def vplay(c: Client, m: Message):
invitelink = invitelink.replace( invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/" "https://t.me/+", "https://t.me/joinchat/"
) )
await ubot.join_chat(invitelink) await user.join_chat(invitelink)
except UserNotParticipant: except UserNotParticipant:
try: try:
ubot = (await user.get_me()).id
invitelink = await c.export_chat_invite_link(chat_id) invitelink = await c.export_chat_invite_link(chat_id)
if invitelink.startswith("https://t.me/+"): if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace( invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/" "https://t.me/+", "https://t.me/joinchat/"
) )
await ubot.join_chat(invitelink) await user.join_chat(invitelink)
except UserAlreadyParticipant: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e:
@ -346,16 +345,15 @@ async def vstream(c: Client, m: Message):
invitelink = invitelink.replace( invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/" "https://t.me/+", "https://t.me/joinchat/"
) )
await ubot.join_chat(invitelink) await user.join_chat(invitelink)
except UserNotParticipant: except UserNotParticipant:
try: try:
ubot = (await user.get_me()).id
invitelink = await c.export_chat_invite_link(chat_id) invitelink = await c.export_chat_invite_link(chat_id)
if invitelink.startswith("https://t.me/+"): if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace( invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/" "https://t.me/+", "https://t.me/joinchat/"
) )
await ubot.join_chat(invitelink) await user.join_chat(invitelink)
except UserAlreadyParticipant: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e: