merge pull request #141 from Xtao-Labs/invite

[fix] InviteHashExpired
This commit is contained in:
levina 2022-02-12 11:28:26 +07:00 committed by GitHub
commit dbbfb46f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked": if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot) 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/+"): 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/"
@ -120,7 +123,10 @@ async def play(c: Client, m: Message):
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
except UserNotParticipant: except UserNotParticipant:
try: 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/+"): 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/"

View File

@ -23,7 +23,11 @@ async def join_chat(c: Client, m: Message):
await m.reply_text("❗️ **You've blocked from using this bot!**") await m.reply_text("❗️ **You've blocked from using this bot!**")
return return
try: 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/+"): 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/"

View File

@ -126,7 +126,10 @@ async def vplay(c: Client, m: Message):
b = await c.get_chat_member(chat_id, ubot) b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked": if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot) 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/+"): 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/"
@ -135,7 +138,10 @@ async def vplay(c: Client, m: Message):
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
except UserNotParticipant: except UserNotParticipant:
try: 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/+"): 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/"
@ -422,7 +428,10 @@ async def vstream(c: Client, m: Message):
b = await c.get_chat_member(chat_id, ubot) b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked": if b.status == "kicked":
await c.unban_chat_member(chat_id, ubot) 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/+"): 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/"
@ -431,7 +440,10 @@ async def vstream(c: Client, m: Message):
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
except UserNotParticipant: except UserNotParticipant:
try: 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/+"): 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/"