refactor: 统一类型注解风格并优化代码结构
- 将裸 except 改为显式 Exception 捕获 - 用列表推导式替换冗余 for 循环 - 为类属性添加 ClassVar 注解 - 统一 Union/Optional 写法为 | - 移除未使用的导入 - 修复 SQLAlchemy 空值比较语法 - 优化字符串拼接与字典更新逻辑 - 补充缺失的 noqa 注释与异常链 BREAKING CHANGE: 所有插件基类的类级字段现要求显式 ClassVar 注解,自定义插件需同步更新
This commit is contained in:
@@ -18,7 +18,7 @@ def get_voice_key(base64_content: str) -> str:
|
||||
def register_self_voice(base64_content: str, text: str):
|
||||
"""
|
||||
为机器人自己发送的语音消息注册其原始文本。
|
||||
|
||||
|
||||
Args:
|
||||
base64_content (str): 语音的base64编码内容。
|
||||
text (str): 原始文本。
|
||||
@@ -30,10 +30,10 @@ def consume_self_voice_text(base64_content: str) -> str | None:
|
||||
"""
|
||||
获取并移除机器人自己发送的语音消息的原始文本。
|
||||
这是一个一次性操作,获取后即从缓存中删除。
|
||||
|
||||
|
||||
Args:
|
||||
base64_content (str): 语音的base64编码内容。
|
||||
|
||||
|
||||
Returns:
|
||||
str | None: 如果找到,则返回原始文本,否则返回None。
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user