mirror of
https://github.com/Xtao-Labs/sticker-captcha-bot.git
synced 2024-11-23 00:11:49 +00:00
20 lines
766 B
Python
20 lines
766 B
Python
import contextlib
|
|
|
|
from pyrogram.types import ChatMemberUpdated
|
|
|
|
from sticker.single_utils import Client
|
|
from sticker import bot
|
|
|
|
MSG_PUBLIC = """您好,我发现此群组为公开群组,您需要联系创建者打开 `管理员批准后才能入群` 功能,我才能正常工作。"""
|
|
MSG_SUCCESS = """验证成功,您已经成为群组的一员了!"""
|
|
MSG_FAILURE = """验证失败,请重试。"""
|
|
|
|
|
|
@bot.on_chat_member_updated()
|
|
async def invite(client: Client, chat_member_updated: ChatMemberUpdated):
|
|
chat = chat_member_updated.chat
|
|
if user := chat_member_updated.new_chat_member:
|
|
if user.user.is_self and chat.username:
|
|
with contextlib.suppress(Exception):
|
|
await client.send_message(chat.id, MSG_PUBLIC)
|