This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
EmojiCaptchaBot/modules/kicker.py

38 lines
1.1 KiB
Python

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)
group = await app.find_group(group_id)
if user.score == 0 and user.failed == 0:
if group.ban_failed:
banned = await app.ban_chat_member(group_id, user_id)
if isinstance(banned, Message):
await banned.delete()
await user.set_failed(True)
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)
group = await app.find_group(group_id)
if user.score < 6 or user.failed:
if group.ban_failed:
banned = await app.ban_chat_member(group_id, user_id)
if isinstance(banned, Message):
await banned.delete()
await user.set_failed(True)
await app.delete_messages(group_id, message_id)