some fixes
This commit is contained in:
parent
b4983945cc
commit
844f5552f5
@ -5,6 +5,7 @@ from pyrogram import Client, filters
|
|||||||
from config import BOT_USERNAME, SUDO_USERS
|
from config import BOT_USERNAME, SUDO_USERS
|
||||||
from driver.filters import command, other_filters
|
from driver.filters import command, other_filters
|
||||||
from driver.database.dbchat import remove_served_chat
|
from driver.database.dbchat import remove_served_chat
|
||||||
|
from driver.database.dbqueue import remove_active_chat
|
||||||
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
|
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
|
||||||
from driver.decorators import authorized_users_only, bot_creator
|
from driver.decorators import authorized_users_only, bot_creator
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ async def join_chat(c: Client, m: Message):
|
|||||||
"https://t.me/+", "https://t.me/joinchat/"
|
"https://t.me/+", "https://t.me/joinchat/"
|
||||||
)
|
)
|
||||||
await user.join_chat(invitelink)
|
await user.join_chat(invitelink)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
return await user.send_message(chat_id, "✅ userbot joined chat")
|
return await user.send_message(chat_id, "✅ userbot joined chat")
|
||||||
except UserAlreadyParticipant:
|
except UserAlreadyParticipant:
|
||||||
return await user.send_message(chat_id, "✅ userbot already in chat")
|
return await user.send_message(chat_id, "✅ userbot already in chat")
|
||||||
@ -35,6 +37,7 @@ async def leave_chat(_, m: Message):
|
|||||||
chat_id = m.chat.id
|
chat_id = m.chat.id
|
||||||
try:
|
try:
|
||||||
await user.leave_chat(chat_id)
|
await user.leave_chat(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
return await _.send_message(
|
return await _.send_message(
|
||||||
chat_id,
|
chat_id,
|
||||||
"✅ userbot leaved chat",
|
"✅ userbot leaved chat",
|
||||||
@ -59,6 +62,7 @@ async def leave_all(client, message):
|
|||||||
async for dialog in user.iter_dialogs():
|
async for dialog in user.iter_dialogs():
|
||||||
try:
|
try:
|
||||||
await user.leave_chat(dialog.chat.id)
|
await user.leave_chat(dialog.chat.id)
|
||||||
|
await remove_active_chat(dialog.chat.id)
|
||||||
left += 1
|
left += 1
|
||||||
await msg.edit(
|
await msg.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."
|
||||||
@ -83,3 +87,4 @@ async def bot_kicked(c: Client, m: Message):
|
|||||||
if left_member.id == bot_id:
|
if left_member.id == bot_id:
|
||||||
await user.leave_chat(chat_id)
|
await user.leave_chat(chat_id)
|
||||||
await remove_served_chat(chat_id)
|
await remove_served_chat(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user