mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-29 13:47:14 +00:00
fix: 前缀响应时图片被错误地转换为文字 (#820)
This commit is contained in:
@@ -20,11 +20,14 @@ class PrefixRule(rule_model.GroupRespondRule):
|
|||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
if message_text.startswith(prefix):
|
if message_text.startswith(prefix):
|
||||||
|
|
||||||
|
# 查找第一个plain元素
|
||||||
|
for me in message_chain:
|
||||||
|
if isinstance(me, mirai.Plain):
|
||||||
|
me.text = me.text[len(prefix):]
|
||||||
|
|
||||||
return entities.RuleJudgeResult(
|
return entities.RuleJudgeResult(
|
||||||
matching=True,
|
matching=True,
|
||||||
replacement=mirai.MessageChain([
|
replacement=message_chain,
|
||||||
mirai.Plain(message_text[len(prefix):])
|
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return entities.RuleJudgeResult(
|
return entities.RuleJudgeResult(
|
||||||
|
|||||||
Reference in New Issue
Block a user