some fixes
This commit is contained in:
parent
7a123c2475
commit
6cf1b925a4
@ -1,69 +1,66 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from helpers.filters import command
|
|
||||||
from pyrogram import Client, filters
|
|
||||||
from config import BOT_USERNAME, SUDO_USERS
|
from config import BOT_USERNAME, SUDO_USERS
|
||||||
|
from driver.decorators import authorized_users_only, sudo_users_only, errors
|
||||||
|
from driver.filters import command
|
||||||
|
from driver.veez import call_py as USER
|
||||||
|
from pyrogram import Client, filters
|
||||||
from pyrogram.errors import UserAlreadyParticipant
|
from pyrogram.errors import UserAlreadyParticipant
|
||||||
from helpers.decorators import authorized_users_only, errors
|
|
||||||
|
|
||||||
@Client.on_message(
|
@Client.on_message(
|
||||||
command(["userbotjoin", f"userbotjoin@{BOT_USERNAME}"]) & ~filters.private & ~filters.bot
|
command(["userbotjoin", f"userbotjoin@{BOT_USERNAME}"]) & ~filters.private & ~filters.bot
|
||||||
)
|
)
|
||||||
@authorized_users_only
|
@authorized_users_only
|
||||||
@errors
|
@errors
|
||||||
async def addchannel(client, message):
|
async def join_group(client, message):
|
||||||
chid = message.chat.id
|
chid = message.chat.id
|
||||||
try:
|
try:
|
||||||
invitelink = await client.export_chat_invite_link(chid)
|
invitelink = await client.export_chat_invite_link(chid)
|
||||||
except:
|
except BaseException:
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"<b>• **i'm not have permission:**\n\n» ❌ __Add Users__</b>",
|
"• **i'm not have permission:**\n\n» ❌ __Add Users__",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = await USER.get_me()
|
user = await USER.get_me()
|
||||||
except:
|
except BaseException:
|
||||||
user.first_name = "music assistant"
|
user.first_name = "music assistant"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await USER.join_chat(invitelink)
|
await USER.join_chat(invitelink)
|
||||||
await USER.send_message(
|
|
||||||
message.chat.id, "🤖: i'm joined here for playing music on voice chat"
|
|
||||||
)
|
|
||||||
except UserAlreadyParticipant:
|
except UserAlreadyParticipant:
|
||||||
await message.reply_text(
|
pass
|
||||||
f"<b>✅ userbot already joined chat</b>",
|
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
f"<b>🛑 Flood Wait Error 🛑 \n\n User {user.first_name} couldn't join your group due to heavy join requests for userbot."
|
f"🛑 Flood Wait Error 🛑 \n\n**userbot couldn't join your group due to heavy join requests for userbot**"
|
||||||
"\n\nor manually add assistant to your Group and try again</b>",
|
"\n\n**or add assistant manually to your Group and try again**",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
f"<b>✅ userbot successfully joined chat</b>",
|
f"✅ **userbot succesfully entered chat**",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@Client.on_message(
|
@Client.on_message(command(["userbotleave",
|
||||||
command(["userbotleave", f"userbotleave@{BOT_USERNAME}"]) & filters.group & ~filters.edited
|
f"leave@{BOT_USERNAME}"]) & filters.group & ~filters.edited)
|
||||||
)
|
|
||||||
@authorized_users_only
|
@authorized_users_only
|
||||||
async def rem(client, message):
|
async def leave_one(client, message):
|
||||||
try:
|
try:
|
||||||
await USER.send_message(message.chat.id, "✅ userbot successfully left chat")
|
await USER.send_message(message.chat.id, "✅ userbot successfully left chat")
|
||||||
await USER.leave_chat(message.chat.id)
|
await USER.leave_chat(message.chat.id)
|
||||||
except:
|
except BaseException:
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"<b>user couldn't leave your group, may be floodwaits.\n\nor manually kick me from your group</b>"
|
"❌ **userbot couldn't leave your group, may be floodwaits.**\n\n**» or manually kick userbot from your group**"
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"]))
|
@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"]))
|
||||||
async def bye(client, message):
|
@sudo_users_only
|
||||||
|
async def leave_all(client, message):
|
||||||
if message.from_user.id not in SUDO_USERS:
|
if message.from_user.id not in SUDO_USERS:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -77,12 +74,12 @@ async def bye(client, message):
|
|||||||
await lol.edit(
|
await lol.edit(
|
||||||
f"Userbot leaving all group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
f"Userbot leaving all group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||||
)
|
)
|
||||||
except:
|
except BaseException:
|
||||||
failed += 1
|
failed += 1
|
||||||
await lol.edit(
|
await lol.edit(
|
||||||
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||||
)
|
)
|
||||||
await asyncio.sleep(0.7)
|
await asyncio.sleep(0.7)
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.chat.id, f"Left {left} chats.\nFailed {failed} chats."
|
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user