Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
1a3cba54
Commit
1a3cba54
authored
Sep 28, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sending log limit.
parent
9ecef962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
coolq/api.go
coolq/api.go
+14
-4
No files found.
coolq/api.go
View file @
1a3cba54
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"path"
"path"
"runtime"
"runtime"
"strconv"
"strconv"
"strings"
"time"
"time"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/binary"
...
@@ -125,7 +126,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
...
@@ -125,7 +126,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
m
.
String
(
),
mid
)
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
limitedString
(
m
.
String
()
),
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
return
OK
(
MSG
{
"message_id"
:
mid
})
}
}
str
=
func
()
string
{
str
=
func
()
string
{
...
@@ -152,7 +153,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
...
@@ -152,7 +153,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
str
,
mid
)
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
limitedString
(
str
)
,
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
return
OK
(
MSG
{
"message_id"
:
mid
})
}
}
...
@@ -249,7 +250,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
...
@@ -249,7 +250,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
m
.
String
(
),
mid
)
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
limitedString
(
m
.
String
()
),
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
return
OK
(
MSG
{
"message_id"
:
mid
})
}
}
str
=
func
()
string
{
str
=
func
()
string
{
...
@@ -274,7 +275,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
...
@@ -274,7 +275,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
if
mid
==
-
1
{
if
mid
==
-
1
{
return
Failed
(
100
)
return
Failed
(
100
)
}
}
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
str
,
mid
)
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
limitedString
(
str
)
,
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
return
OK
(
MSG
{
"message_id"
:
mid
})
}
}
...
@@ -758,3 +759,12 @@ func convertGroupMemberInfo(groupId int64, m *client.GroupMemberInfo) MSG {
...
@@ -758,3 +759,12 @@ func convertGroupMemberInfo(groupId int64, m *client.GroupMemberInfo) MSG {
"card_changeable"
:
false
,
"card_changeable"
:
false
,
}
}
}
}
func
limitedString
(
str
string
)
string
{
if
strings
.
Count
(
str
,
""
)
<=
10
{
return
str
}
limited
:=
[]
rune
(
str
)
limited
=
limited
[
:
10
]
return
string
(
limited
)
+
" ..."
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment