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: 发送 `/fquote + 文字`."""
16 cid = message.chat.id
17 if cid not in [GROUP_DEV, CHANNEL_FAVORITE, USER_BENNY, USER_XIAOHAO, GROUP_67373, GROUP_JSQ] or not startswith_prefix(message.content, prefix="/fquote"):
18 return
19 # VPS上的账号不响应 开发Group 的消息
20 if cid == GROUP_DEV and DEVICE_NAME in ["BennyBot-JP", "BennyBot-US", "BennyBot-CN"]:
21 return
22 uid = glom(message, "from_user.id", default=0) or 0
23 if uid not in [USER_BENNY, USER_XIAOHAO]: # 只允许我自己使用
24 return
25 text = message.content.removeprefix("/fquote").strip()
26 text = f"{PREFIX.QUOTLY} cid={GROUP_67373} uid={USER_CYF} {text}"
27 message.text = Str(text)
28 await quote_message(client, message, **kwargs)