[fix] InviteHashExpired

This commit is contained in:
xtaodada 2022-02-12 12:05:44 +08:00
parent 7e03c08859
commit 85a95f38da
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
3 changed files with 32 additions and 10 deletions

View File

@ -111,7 +111,10 @@ async def play(c: Client, m: Message):
b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot)
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"
@ -120,7 +123,10 @@ async def play(c: Client, m: Message):
await remove_active_chat(chat_id)
except UserNotParticipant:
try:
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"

View File

@ -23,14 +23,18 @@ async def join_chat(c: Client, m: Message):
await m.reply_text("❗️ **You've blocked from using this bot!**")
return
try:
invitelink = await c.export_chat_invite_link(chat_id)
# If it exists, use it.
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"
)
await user.join_chat(invitelink)
await remove_active_chat(chat_id)
return await user.send_message(chat_id, "✅ userbot joined chat")
await user.join_chat(invitelink)
await remove_active_chat(chat_id)
return await user.send_message(chat_id, "✅ userbot joined chat")
except UserAlreadyParticipant:
return await user.send_message(chat_id, "✅ userbot already in chat")

View File

@ -126,7 +126,10 @@ async def vplay(c: Client, m: Message):
b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot)
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"
@ -135,7 +138,10 @@ async def vplay(c: Client, m: Message):
await remove_active_chat(chat_id)
except UserNotParticipant:
try:
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"
@ -422,7 +428,10 @@ async def vstream(c: Client, m: Message):
b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot)
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"
@ -431,7 +440,10 @@ async def vstream(c: Client, m: Message):
await remove_active_chat(chat_id)
except UserNotParticipant:
try:
invitelink = await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if not invitelink:
await c.export_chat_invite_link(chat_id)
invitelink = (await c.get_chat(chat_id)).invite_link
if invitelink.startswith("https://t.me/+"):
invitelink = invitelink.replace(
"https://t.me/+", "https://t.me/joinchat/"