main
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3from glom import glom
4from pyrogram.client import Client
5from pyrogram.types import Message
6from pyrogram.types.messages_and_media.message import Str
7
8from config import DEVICE_NAME, PREFIX
9from custom.config import CHANNEL_FAVORITE, GROUP_67373, GROUP_DEV, GROUP_JSQ, USER_BENNY, USER_CYF, USER_XIAOHAO
10from messages.utils import startswith_prefix
11from quotly.quotly import quote_message
12
13
14async def fafa_quote(client: Client, message: Message, **kwargs):
15 """模拟发姐发言sticker: 发送 `/fa + 文字`."""
16 cid = message.chat.id
17 if (
18 cid not in [GROUP_DEV, CHANNEL_FAVORITE, USER_BENNY, USER_XIAOHAO, GROUP_67373, GROUP_JSQ]
19 or startswith_prefix(message.content, prefix="/fafa,/fav") # 忽略这些
20 or not startswith_prefix(message.content, prefix="/fa")
21 ):
22 return
23 # VPS上的账号不响应 开发Group 的消息
24 if cid == GROUP_DEV and DEVICE_NAME in ["BennyBot-JP", "BennyBot-US", "BennyBot-CN"]:
25 return
26 uid = glom(message, "from_user.id", default=0) or 0
27 if uid not in [USER_BENNY, USER_XIAOHAO]: # 只允许我自己使用
28 return
29 text = message.content.removeprefix("/fa").strip()
30 text = f"{PREFIX.QUOTLY} cid={GROUP_67373} uid={USER_CYF} {text}"
31 message.text = Str(text)
32 await quote_message(client, message, **kwargs)