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
894a5d96
Commit
894a5d96
authored
Aug 22, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Content-Type.
parent
30ff0551
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
3 deletions
+10
-3
coolq/api.go
coolq/api.go
+1
-0
coolq/bot.go
coolq/bot.go
+4
-0
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
server/http.go
server/http.go
+2
-2
No files found.
coolq/api.go
View file @
894a5d96
...
...
@@ -137,6 +137,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
str
=
s
}
if
str
==
""
{
log
.
Warnf
(
"群消息发送失败: 信息为空. MSG: %v"
,
i
)
return
Failed
(
100
)
}
var
elem
[]
message
.
IMessageElement
...
...
coolq/bot.go
View file @
894a5d96
...
...
@@ -131,6 +131,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
m
.
Elements
=
newElem
ret
:=
bot
.
Client
.
SendGroupMessage
(
groupId
,
m
)
if
ret
==
nil
||
ret
.
Id
==
-
1
{
log
.
Warnf
(
"群消息发送失败: 账号可能被风控."
)
return
-
1
}
return
bot
.
InsertGroupMessage
(
ret
)
...
...
@@ -227,6 +228,9 @@ func formatGroupName(group *client.GroupInfo) string {
}
func
formatMemberName
(
mem
*
client
.
GroupMemberInfo
)
string
{
if
mem
==
nil
{
return
"未知"
}
return
fmt
.
Sprintf
(
"%s(%d)"
,
mem
.
DisplayName
(),
mem
.
Uin
)
}
...
...
go.mod
View file @
894a5d96
...
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-202008211
11822-80481f0022d
5
github.com/Mrs4s/MiraiGo v0.0.0-202008211
64244-fe8e98b9d8c
5
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2
...
...
go.sum
View file @
894a5d96
...
...
@@ -2,6 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Mrs4s/MiraiGo v0.0.0-20200821111822-80481f0022d5 h1:50yz9Xgup7WgFAxeen/GQ0fCX3YUvv+ipGktZIznDuU=
github.com/Mrs4s/MiraiGo v0.0.0-20200821111822-80481f0022d5/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200821164244-fe8e98b9d8c5 h1:LVzj3ahW0LYJQMDcDm+MRPevKEFg8+VJ9iOGjF4yNOo=
github.com/Mrs4s/MiraiGo v0.0.0-20200821164244-fe8e98b9d8c5/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
...
...
server/http.go
View file @
894a5d96
...
...
@@ -404,12 +404,12 @@ func getParamWithType(c *gin.Context, k string) (string, gjson.Type) {
}
if
c
.
Request
.
Method
==
"POST"
{
if
h
:=
c
.
Request
.
Header
.
Get
(
"Content-Type"
);
h
!=
""
{
if
h
==
"application/x-www-form-urlencoded"
{
if
strings
.
Contains
(
h
,
"application/x-www-form-urlencoded"
)
{
if
p
,
ok
:=
c
.
GetPostForm
(
k
);
ok
{
return
p
,
gjson
.
Null
}
}
if
h
==
"application/json"
{
if
strings
.
Contains
(
h
,
"application/json"
)
{
if
obj
,
ok
:=
c
.
Get
(
"json_body"
);
ok
{
res
:=
obj
.
(
gjson
.
Result
)
.
Get
(
k
)
if
res
.
Exists
()
{
...
...
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