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

32 lines
862 B
Python
Raw Normal View History

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