1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08: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
commit 336be30cc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}
}