1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

genLongTemplate 非ASCII字符串长度计数错误

一个字切成半个啦😭
This commit is contained in:
icarus-ai 2022-05-17 16:08:17 +08:00 committed by GitHub
parent 62b5678c94
commit fc9a403abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,8 +307,8 @@ func genForwardTemplate(resID, preview, summary string, ts int64, items []*msg.P
func genLongTemplate(resID, brief string, ts int64) *message.ServiceElement {
limited := func() string {
if len(brief) > 30 {
return brief[:30] + "…"
if ss := []rune(brief); len(ss) > 30 {
return string(ss[:30]) + "…"
}
return brief
}()