1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-07-03 05:03:26 +00:00

Merge pull request #138 from sam01101/patch-msg-len

Fix message length problem
This commit is contained in:
Mrs4s
2021-03-23 19:15:10 +08:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@ -248,7 +248,7 @@ func (msg *SendingMessage) ToFragmented() [][]IMessageElement {
func EstimateLength(elems []IMessageElement, limit int) int {
sum := 0
for _, elem := range elems {
if sum >= limit {
if sum > limit {
break
}
left := int(math.Max(float64(limit-sum), 0))

View File

@ -55,7 +55,7 @@ func ChineseLength(str string, limit int) int {
default:
sum += 4
}
if sum >= limit {
if sum > limit {
break
}
}