From 5407f70099c1add7fd0b5809d2ac8ffdd4db85ea Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 25 Nov 2021 22:22:55 +0700 Subject: [PATCH] trying to fix --- program/music.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/program/music.py b/program/music.py index 0a0d281..9e8c269 100644 --- a/program/music.py +++ b/program/music.py @@ -303,8 +303,8 @@ async def stream(c: Client, m: Message): await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__") return try: - ubot = await user.get_me() - b = await c.get_chat_member(chat_id, ubot.id) + ubot = (await user.get_me()).id + b = await c.get_chat_member(chat_id, ubot) if b.status == "kicked": await m.reply_text( f"@{ASSISTANT_NAME} **is banned in group** {m.chat.title}\n\n» **unban the userbot first if you want to use this bot.**" @@ -319,9 +319,12 @@ async def stream(c: Client, m: Message): return else: try: - pope = await c.export_chat_invite_link(chat_id) - pepo = await c.revoke_chat_invite_link(chat_id, pope) - await user.join_chat(pepo.invite_link) + user_id = (await user.get_me()).id + link = await c.export_chat_invite_link(chat_id) + if "+" in link: + link_hash = (link.replace("+", "")).split("t.me/")[1] + await ubot.join_chat(link_hash) + await c.promote_member(chat_id, user_id) except UserAlreadyParticipant: pass except Exception as e: