async def _(session: CommandSession): ctx_id = context_id(session.event) stripped_arg = session.current_arg_text.strip() key_str,value_str = stripped_arg.split("=") mvl = Load_Reply.value_max_len(ctx_id) mkl = Load_Reply.key_max_len(ctx_id) if len(value_str)>mvl or len(key_str)>mkl: if len(value_str)>mvl: await session.send(f"‘{value_str}’作为value过长,目前最大长度为{mvl}个字") if len(key_str)>mkl: await session.send(f"‘{key_str}’作为key过长,目前最大长度为{mkl}个字") else: Load_Reply.add_key(ctx_id = ctx_id,key_str = key_str,value_str = value_str) await session.send(f"已添加私有关键词{key_str}=>{value_str}")
async def _(session: NLPSession): global replymsg ctx_id = context_id(session.event) raw_msg = session.msg_text.strip() replymsg = Load_Reply.key_is_exist(ctx_id,raw_msg) if not replymsg == "None": return IntentCommand(61.0,'send_reply')
async def _(session: CommandSession): lst = Load_Reply.show_keys() await session.send('共有关键词列表:\n'+str(lst))
async def _(session: CommandSession): Load_Reply.clear_keys() await session.send("已清空共有关键词列表")
async def _(session: CommandSession): Load_Reply.del_key(key_str = session.current_arg_text.strip()) await session.send(f"已删除共有关键词{session.current_arg_text.strip()}")
async def _(session: CommandSession): stripped_arg = session.current_arg_text.strip() key_str,value_str = stripped_arg.split("=") Load_Reply.add_key(key_str = key_str,value_str = value_str) await session.send(f"已添加共有关键词{key_str}=>{value_str}")
async def _(session: CommandSession): lst = Load_Reply.show_keys(ctx_id = context_id(session.event)) await session.send('私有关键词列表:\n'+str(lst))
async def _(session: CommandSession): ctx_id = context_id(session.event) Load_Reply.clear_keys(ctx_id = ctx_id) await session.send("已清空私有关键词列表")
async def _(session: CommandSession): ctx_id = context_id(session.event) Load_Reply.del_key(ctx_id = ctx_id,key_str = session.current_arg_text.strip()) await session.send(f"已删除私有关键词{session.current_arg_text.strip()}")