2023-08-10 14:05:40 +03:00
|
|
|
from pyrogram.types import Message
|
|
|
|
|
|
|
|
from classes.pyroclient import PyroClient
|
|
|
|
|
|
|
|
|
|
|
|
async def kick_unstarted(
|
|
|
|
app: PyroClient, user_id: int, group_id: int, message_id: int
|
|
|
|
) -> None:
|
|
|
|
user = await app.find_user(user_id, group_id)
|
2023-08-17 17:37:42 +03:00
|
|
|
group = await app.find_group(group_id)
|
2023-08-10 14:05:40 +03:00
|
|
|
|
|
|
|
if user.score == 0 and user.failed == 0:
|
2023-08-14 13:11:53 +03:00
|
|
|
if group.ban_failed:
|
|
|
|
banned = await app.ban_chat_member(group_id, user_id)
|
2023-08-10 14:05:40 +03:00
|
|
|
|
2023-08-14 13:11:53 +03:00
|
|
|
if isinstance(banned, Message):
|
|
|
|
await banned.delete()
|
2023-08-10 14:05:40 +03:00
|
|
|
|
2023-08-14 13:46:03 +03:00
|
|
|
await user.set_failed(True)
|
2023-08-10 14:05:40 +03:00
|
|
|
await app.delete_messages(group_id, message_id)
|
|
|
|
|
|
|
|
|
|
|
|
async def kick_unverified(
|
|
|
|
app: PyroClient, user_id: int, group_id: int, message_id: int
|
|
|
|
) -> None:
|
|
|
|
user = await app.find_user(user_id, group_id)
|
2023-08-17 17:37:42 +03:00
|
|
|
group = await app.find_group(group_id)
|
2023-08-10 14:05:40 +03:00
|
|
|
|
|
|
|
if user.score < 6 or user.failed:
|
2023-08-14 13:11:53 +03:00
|
|
|
if group.ban_failed:
|
|
|
|
banned = await app.ban_chat_member(group_id, user_id)
|
2023-08-10 14:05:40 +03:00
|
|
|
|
2023-08-14 13:11:53 +03:00
|
|
|
if isinstance(banned, Message):
|
|
|
|
await banned.delete()
|
2023-08-10 14:05:40 +03:00
|
|
|
|
2023-08-14 13:46:03 +03:00
|
|
|
await user.set_failed(True)
|
2023-08-10 14:05:40 +03:00
|
|
|
await app.delete_messages(group_id, message_id)
|