fix: 修复批量消息存储缺失字段导致的NOT NULL约束失败

This commit is contained in:
Windpicker-owo
2025-11-01 17:59:01 +08:00
parent 56df2d2252
commit fcb82e1a74

View File

@@ -179,6 +179,12 @@ class MessageStorageBatcher:
is_picid = message.is_picid or False
is_notify = message.is_notify or False
is_command = message.is_command or False
is_public_notice = message.is_public_notice or False
notice_type = message.notice_type
actions = message.actions
should_reply = message.should_reply
should_act = message.should_act
additional_config = message.additional_config
key_words = ""
key_words_lite = ""
memorized_times = 0
@@ -226,6 +232,12 @@ class MessageStorageBatcher:
is_picid = False
is_notify = False
is_command = False
is_public_notice = False
notice_type = None
actions = None
should_reply = None
should_act = None
additional_config = None
key_words = ""
key_words_lite = ""
else:
@@ -239,6 +251,12 @@ class MessageStorageBatcher:
is_picid = message.is_picid
is_notify = message.is_notify
is_command = message.is_command
is_public_notice = getattr(message, 'is_public_notice', False)
notice_type = getattr(message, 'notice_type', None)
actions = getattr(message, 'actions', None)
should_reply = getattr(message, 'should_reply', None)
should_act = getattr(message, 'should_act', None)
additional_config = getattr(message, 'additional_config', None)
key_words = MessageStorage._serialize_keywords(message.key_words)
key_words_lite = MessageStorage._serialize_keywords(message.key_words_lite)
@@ -300,10 +318,16 @@ class MessageStorageBatcher:
interest_value=interest_value,
priority_mode=priority_mode,
priority_info=priority_info_json,
additional_config=additional_config,
is_emoji=is_emoji,
is_picid=is_picid,
is_notify=is_notify,
is_command=is_command,
is_public_notice=is_public_notice,
notice_type=notice_type,
actions=actions,
should_reply=should_reply,
should_act=should_act,
key_words=key_words,
key_words_lite=key_words_lite,
)