Skip to content

Commit 9801334

Browse files
authored
Update userbotjoin.py
1 parent d9a8ccf commit 9801334

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

Group_Music_Probot/modules/userbotjoin.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import asyncio
2+
13
from pyrogram import Client, filters
24
from pyrogram.errors import UserAlreadyParticipant
35

46
from Group_Music_Probot.helpers.decorators import authorized_users_only, errors
57
from Group_Music_Probot.services.callsmusic.callsmusic import client as USER
6-
8+
from Group_Music_Probot.config import SUDO_USERS
79

810
@Client.on_message(filters.command(["userbotjoin"]) & ~filters.private & ~filters.bot)
911
@authorized_users_only
@@ -21,7 +23,7 @@ async def addchannel(client, message):
2123
try:
2224
user = await USER.get_me()
2325
except:
24-
user.first_name = "DaisyMusic"
26+
user.first_name = "Group Music Probot"
2527

2628
try:
2729
await USER.join_chat(invitelink)
@@ -34,7 +36,7 @@ async def addchannel(client, message):
3436
print(e)
3537
await message.reply_text(
3638
f"<b>🛑 Flood Wait Error 🛑 \n User {user.first_name} couldn't join your group due to heavy join requests for userbot! Make sure user is not banned in group."
37-
"\n\nOr manually add @DaisyXhelper to your Group and try again</b>",
39+
"\n\nOr manually add @Group_Music_Pro to your Group and try again</b>",
3840
)
3941
return
4042
await message.reply_text(
@@ -43,6 +45,7 @@ async def addchannel(client, message):
4345

4446

4547
@USER.on_message(filters.group & filters.command(["userbotleave"]))
48+
@authorized_users_only
4649
async def rem(USER, message):
4750
try:
4851
await USER.leave_chat(message.chat.id)
@@ -52,7 +55,23 @@ async def rem(USER, message):
5255
"\n\nOr manually kick me from to your Group</b>",
5356
)
5457
return
55-
58+
59+
@Client.on_message(filters.command(["userbotleaveall"]))
60+
async def bye(client, message):
61+
if message.from_user.id in SUDO_USERS:
62+
left=0
63+
failed=0
64+
await message.reply("Assistant Leaving all chats")
65+
for dialog in USER.iter_dialogs():
66+
try:
67+
await USER.leave_chat(dialog.chat.id)
68+
left = left+1
69+
except:
70+
failed=failed+1
71+
await asyncio.sleep(3)
72+
await client.send_message(message.chat.id, f"Left {left} chats. Failed {failed} chats.")
73+
74+
5675
@Client.on_message(filters.command(["userbotjoinchannel","ubjoinc"]) & ~filters.private & ~filters.bot)
5776
@authorized_users_only
5877
@errors
@@ -90,7 +109,7 @@ async def addcchannel(client, message):
90109
print(e)
91110
await message.reply_text(
92111
f"<b>🛑 Flood Wait Error 🛑 \n User {user.first_name} couldn't join your channel due to heavy join requests for userbot! Make sure user is not banned in channel."
93-
"\n\nOr manually add @DaisyXhelper to your Group and try again</b>",
112+
"\n\nOr manually add @Group_Music_Pro to your Group and try again</b>",
94113
)
95114
return
96115
await message.reply_text(

0 commit comments

Comments
 (0)