mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 11:26:47 +00:00
添加导入导出数据功能 (#127)
This commit is contained in:
parent
5a860c04c3
commit
23ad62b495
31
keyword.py
31
keyword.py
@ -783,6 +783,37 @@ async def funcset(context):
|
||||
pass
|
||||
|
||||
|
||||
@listener(outgoing=True, command="keyworddata",
|
||||
description="设置规则数据",
|
||||
parameters="dump / load")
|
||||
async def setdata(context):
|
||||
try:
|
||||
chat_id = context.chat_id
|
||||
params = context.parameter
|
||||
if params[0] == "dump":
|
||||
data = redis.get(f"keyword.{chat_id}.{params[1]}")
|
||||
if not data:
|
||||
await context.edit("无规则数据")
|
||||
await del_msg(context, 5)
|
||||
return
|
||||
data = str(data, "ascii")
|
||||
await context.edit(data)
|
||||
return
|
||||
elif params[0] == "load":
|
||||
redis.set(f"keyword.{chat_id}.{params[1]}", params[2])
|
||||
await context.edit("设置成功")
|
||||
await del_msg(context, 5)
|
||||
return
|
||||
else:
|
||||
await context.edit("参数错误")
|
||||
await del_msg(context, 5)
|
||||
return
|
||||
except:
|
||||
await context.edit("运行错误")
|
||||
await del_msg(context, 5)
|
||||
return
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=False)
|
||||
async def auto_reply(context):
|
||||
if not redis_status():
|
||||
|
@ -362,13 +362,13 @@
|
||||
},
|
||||
{
|
||||
"name": "keyword",
|
||||
"version": "2.54",
|
||||
"version": "2.55",
|
||||
"section": "chat",
|
||||
"maintainer": "c3b2a,xtaodada",
|
||||
"size": "36.5 kb",
|
||||
"size": "36.7 kb",
|
||||
"supported": true,
|
||||
"des-short": "群组关键词自动回复插件",
|
||||
"des": "命令: keyword, replyset, funcset。"
|
||||
"des-short": "关键词自动回复插件。",
|
||||
"des": "命令: keyword, keyworddata, replyset, funcset。"
|
||||
},
|
||||
{
|
||||
"name": "msgst",
|
||||
|
Loading…
Reference in New Issue
Block a user