mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 12:51:04 +00:00
keyword 问题修复
This commit is contained in:
parent
51e01490a2
commit
3fd37a3147
@ -972,14 +972,15 @@ async def setdata(context):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@listener(incoming=True, outgoing=True, ignore_edited=False)
|
@listener(incoming=True, outgoing=True, ignore_edited=True)
|
||||||
async def auto_reply(context):
|
async def auto_reply(context):
|
||||||
|
global read_context
|
||||||
if not redis_status():
|
if not redis_status():
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
chat_id = context.chat_id
|
chat_id = context.chat_id
|
||||||
sender_id = context.sender_id
|
sender_id = context.sender_id
|
||||||
if f"{chat_id}:{context.id}" not in read_context:
|
if (chat_id, context.id) not in read_context:
|
||||||
n_settings = get_redis(f"keyword.{chat_id}.settings")
|
n_settings = get_redis(f"keyword.{chat_id}.settings")
|
||||||
if n_settings.get("status", "1") == "0":
|
if n_settings.get("status", "1") == "0":
|
||||||
return
|
return
|
||||||
@ -1019,7 +1020,7 @@ async def auto_reply(context):
|
|||||||
if tmp:
|
if tmp:
|
||||||
could_reply = validate(str(sender_id), int(tmp.get("mode", "0")), tmp.get("list", []))
|
could_reply = validate(str(sender_id), int(tmp.get("mode", "0")), tmp.get("list", []))
|
||||||
if could_reply and (not self_sent or validsent(int(trig), tmp)):
|
if could_reply and (not self_sent or validsent(int(trig), tmp)):
|
||||||
read_context[f"{chat_id}:{context.id}"] = None
|
read_context[(chat_id, context.id)] = None
|
||||||
await send_reply(chat_id, k, "plain", parse_multi(v), context)
|
await send_reply(chat_id, k, "plain", parse_multi(v), context)
|
||||||
for k, v in regex_dict.items():
|
for k, v in regex_dict.items():
|
||||||
pattern = re.compile(k)
|
pattern = re.compile(k)
|
||||||
@ -1029,7 +1030,7 @@ async def auto_reply(context):
|
|||||||
if tmp:
|
if tmp:
|
||||||
could_reply = validate(str(sender_id), int(tmp.get("mode", "0")), tmp.get("list", []))
|
could_reply = validate(str(sender_id), int(tmp.get("mode", "0")), tmp.get("list", []))
|
||||||
if could_reply and (not self_sent or validsent(int(trig), tmp)):
|
if could_reply and (not self_sent or validsent(int(trig), tmp)):
|
||||||
read_context[f"{chat_id}:{context.id}"] = None
|
read_context[(chat_id, context.id)] = None
|
||||||
catch_pattern = r"\$\{regex_(?P<str>((?!\}).)+)\}"
|
catch_pattern = r"\$\{regex_(?P<str>((?!\}).)+)\}"
|
||||||
count = 0
|
count = 0
|
||||||
while re.search(catch_pattern, v) and count < 20:
|
while re.search(catch_pattern, v) and count < 20:
|
||||||
|
Loading…
Reference in New Issue
Block a user