trying to fix

This commit is contained in:
levina 2021-11-25 22:26:25 +07:00 committed by GitHub
parent 5407f70099
commit 6bc696dc5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,8 +94,8 @@ async def vplay(c: Client, m: Message):
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__") await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__")
return return
try: try:
ubot = await user.get_me() ubot = (await user.get_me()).id
b = await c.get_chat_member(chat_id, ubot.id) b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked": if b.status == "kicked":
await m.reply_text( 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.**" f"@{ASSISTANT_NAME} **is banned in group** {m.chat.title}\n\n» **unban the userbot first if you want to use this bot.**"
@ -110,9 +110,12 @@ async def vplay(c: Client, m: Message):
return return
else: else:
try: try:
pope = await c.export_chat_invite_link(chat_id) user_id = (await user.get_me()).id
pepo = await c.revoke_chat_invite_link(chat_id, pope) link = await c.export_chat_invite_link(chat_id)
await user.join_chat(pepo.invite_link) 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: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e:
@ -219,7 +222,7 @@ async def vplay(c: Client, m: Message):
HighQualityAudio(), HighQualityAudio(),
amaze, amaze,
), ),
stream_type=StreamType().local_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, songname, ytlink, url, "Video", Q) add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.delete() await loser.delete()
@ -274,7 +277,7 @@ async def vplay(c: Client, m: Message):
HighQualityAudio(), HighQualityAudio(),
amaze, amaze,
), ),
stream_type=StreamType().local_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, songname, ytlink, url, "Video", Q) add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.delete() await loser.delete()
@ -327,8 +330,8 @@ async def vstream(c: Client, m: Message):
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__") await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__")
return return
try: try:
ubot = await user.get_me() ubot = (await user.get_me()).id
b = await c.get_chat_member(chat_id, ubot.id) b = await c.get_chat_member(chat_id, ubot)
if b.status == "kicked": if b.status == "kicked":
await m.reply_text( 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.**" f"@{ASSISTANT_NAME} **is banned in group** {m.chat.title}\n\n» **unban the userbot first if you want to use this bot.**"
@ -343,9 +346,12 @@ async def vstream(c: Client, m: Message):
return return
else: else:
try: try:
pope = await c.export_chat_invite_link(chat_id) user_id = (await user.get_me()).id
pepo = await c.revoke_chat_invite_link(chat_id, pope) link = await c.export_chat_invite_link(chat_id)
await user.join_chat(pepo.invite_link) 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: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e: