mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 06:32:47 +00:00
keyword重复回复bug不稳定修复
This commit is contained in:
parent
1693ce412d
commit
ed8905220b
@ -1,4 +1,4 @@
|
||||
import re, time, asyncio, requests, os, json
|
||||
import re, time, asyncio, requests, os, json, random
|
||||
from io import BytesIO
|
||||
from os import path, mkdir, remove, makedirs, chdir
|
||||
from shutil import copyfile, move, rmtree
|
||||
@ -975,12 +975,15 @@ async def setdata(context):
|
||||
@listener(incoming=True, outgoing=True, ignore_edited=True)
|
||||
async def auto_reply(context):
|
||||
global read_context
|
||||
asyncio.sleep(random.randint(0, 100) / 1000)
|
||||
if (context.chat_id, context.id) in read_context:
|
||||
return
|
||||
read_context[(context.chat_id, context.id)] = True
|
||||
if not redis_status():
|
||||
return
|
||||
try:
|
||||
chat_id = context.chat_id
|
||||
sender_id = context.sender_id
|
||||
if (chat_id, context.id) not in read_context:
|
||||
n_settings = get_redis(f"keyword.{chat_id}.settings")
|
||||
if n_settings.get("status", "1") == "0":
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user