mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2025-09-04 18:30:43 +00:00
🐛 fix string index out of range while sending messages
This commit is contained in:
parent
4adf580493
commit
8e6dfe4f14
1 changed files with 3 additions and 0 deletions
|
@ -252,6 +252,9 @@ async def process_messages(group_id: int):
|
|||
f"准备发送回复消息 群号:{group_id} 消息分段数:{len(reply.split('<botbr>'))}"
|
||||
)
|
||||
for r in reply.split("<botbr>"):
|
||||
# 似乎会有空消息的情况导致string index out of range异常
|
||||
if r.__len__() < 1:
|
||||
continue
|
||||
# 删除前后多余的换行和空格
|
||||
while r[0] == "\n" or r[0] == " ":
|
||||
r = r[1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue