some fixes

This commit is contained in:
levina 2022-01-18 20:04:19 +07:00 committed by GitHub
parent 5b14b38aa6
commit 1aa27f0c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,19 +83,18 @@ async def vplay(c: Client, m: Message):
return return
if not a.can_manage_voice_chats: if not a.can_manage_voice_chats:
await m.reply_text( await m.reply_text(
"missing required permission:" + "\n\n» ❌ __Manage video chat__" "💡 To use me, Give me the following permission below:"
) + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
return return
if not a.can_delete_messages: if not a.can_delete_messages:
await m.reply_text( await m.reply_text(
"missing required permission:" + "\n\n» ❌ __Delete messages__" "💡 To use me, Give me the following permission below:"
) + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
return return
if not a.can_invite_users: if not a.can_invite_users:
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__") await m.reply_text(
return "💡 To use me, Give me the following permission below:"
if not a.can_promote_members: + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add new Admins__")
return return
try: try:
ubot = (await user.get_me()).id ubot = (await user.get_me()).id
@ -107,10 +106,7 @@ 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 user.join_chat(invitelink) await ubot.join_chat(invitelink)
await m.chat.promote_member(
ubot, can_manage_voice_chats=True
)
except UserNotParticipant: except UserNotParticipant:
try: try:
ubot = (await user.get_me()).id ubot = (await user.get_me()).id
@ -119,10 +115,7 @@ 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 user.join_chat(invitelink) await ubot.join_chat(invitelink)
await m.chat.promote_member(
ubot, can_manage_voice_chats=True
)
except UserAlreadyParticipant: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e:
@ -339,19 +332,18 @@ async def vstream(c: Client, m: Message):
return return
if not a.can_manage_voice_chats: if not a.can_manage_voice_chats:
await m.reply_text( await m.reply_text(
"missing required permission:" + "\n\n» ❌ __Manage video chat__" "💡 To use me, Give me the following permission below:"
) + "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
return return
if not a.can_delete_messages: if not a.can_delete_messages:
await m.reply_text( await m.reply_text(
"missing required permission:" + "\n\n» ❌ __Delete messages__" "💡 To use me, Give me the following permission below:"
) + "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
return return
if not a.can_invite_users: if not a.can_invite_users:
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add users__") await m.reply_text(
return "💡 To use me, Give me the following permission below:"
if not a.can_promote_members: + "\n\n» ❌ __Add users__\n\nOnce done, try again.")
await m.reply_text("missing required permission:" + "\n\n» ❌ __Add new Admins__")
return return
try: try:
ubot = (await user.get_me()).id ubot = (await user.get_me()).id
@ -363,10 +355,7 @@ 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 user.join_chat(invitelink) await ubot.join_chat(invitelink)
await m.chat.promote_member(
ubot, can_manage_voice_chats=True
)
except UserNotParticipant: except UserNotParticipant:
try: try:
ubot = (await user.get_me()).id ubot = (await user.get_me()).id
@ -375,10 +364,7 @@ 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 user.join_chat(invitelink) await ubot.join_chat(invitelink)
await m.chat.promote_member(
ubot, can_manage_voice_chats=True
)
except UserAlreadyParticipant: except UserAlreadyParticipant:
pass pass
except Exception as e: except Exception as e: