This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
forked from Lancercmd/chinchin-pk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
72 lines (63 loc) · 2.19 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from botoy import S,ctx,mark_recv
from botoy import jconfig, logger
from .src.main import message_processor, KEYWORDS, VERSION, HELPPER
from .src.utils import get_object_values, create_match_func_factory
# __version__ = VERSION
# __doc__ = HELPPER
# config = jconfig.get_configuration("chinchin_system")
# groups = config.get("groups")
#
# logger.info(f"{__doc__}:监听群组:{groups}")
keywords = get_object_values(KEYWORDS)
match_func = create_match_func_factory(fuzzy=True)
async def chichipk():
if g:= ctx.g:
from_user = g.from_user
group = g.from_group
nickname = g.from_user_name
def impl_at_segment(qq: int):
# 伪 at ,因为真 at 会风控
return f'@{g.from_user_name}'
async def impl_send_message(qq: int, group: int, message: str):
await S.text(message)
return
if g.at_list != [] :
atlist = g.at_list[0].Nick
data = len(atlist)+2
at_data = g.text[data:]
# FIXME: at all 时 at_data 为 None
# if not at_data:
# return
# 只对 at 一个人生效
# if len(g.at_list) != 1:
# return 0
content = at_data
if not match_func(keywords=keywords, text=content):
return
target = g.at_list[0].Uin
await message_processor(
message=content,
qq=from_user,
at_qq=target,
group=group,
fuzzy_match=True,
nickname=nickname,
impl_at_segment=impl_at_segment,
impl_send_message=impl_send_message
)
return
elif g.images == None:
content = g.text
if not match_func(keywords=keywords, text=content):
return
await message_processor(
message=content,
qq=from_user,
group=group,
fuzzy_match=True,
nickname=nickname,
impl_at_segment=impl_at_segment,
impl_send_message=impl_send_message
)
return
mark_recv(chichipk)