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:
commit
336be30cc8
@ -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))
|
||||
|
@ -55,7 +55,7 @@ func ChineseLength(str string, limit int) int {
|
||||
default:
|
||||
sum += 4
|
||||
}
|
||||
if sum >= limit {
|
||||
if sum > limit {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user