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
3c04573e
Commit
3c04573e
authored
Aug 13, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #89.
parent
5e498203
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
coolq/bot.go
coolq/bot.go
+1
-1
global/config.go
global/config.go
+6
-6
main.go
main.go
+8
-8
No files found.
coolq/bot.go
View file @
3c04573e
...
...
@@ -85,7 +85,7 @@ func (bot *CQBot) GetGroupMessage(mid int32) MSG {
if
err
==
nil
{
return
m
}
log
.
Warnf
(
"获取信息时出现错误: %v
"
,
err
)
log
.
Warnf
(
"获取信息时出现错误: %v
id: %v"
,
err
,
mid
)
}
return
nil
}
...
...
global/config.go
View file @
3c04573e
...
...
@@ -17,6 +17,7 @@ type JsonConfig struct {
HttpConfig
*
GoCQHttpConfig
`json:"http_config"`
WSConfig
*
GoCQWebsocketConfig
`json:"ws_config"`
ReverseServers
[]
*
GoCQReverseWebsocketConfig
`json:"ws_reverse_servers"`
PostMessageFormat
string
`json:"post_message_format"`
Debug
bool
`json:"debug"`
}
...
...
@@ -40,12 +41,11 @@ type CQHttpApiConfig struct {
}
type
GoCQHttpConfig
struct
{
Enabled
bool
`json:"enabled"`
Host
string
`json:"host"`
Port
uint16
`json:"port"`
Timeout
int32
`json:"timeout"`
PostUrls
map
[
string
]
string
`json:"post_urls"`
PostMessageFormat
string
`json:"post_message_format"`
Enabled
bool
`json:"enabled"`
Host
string
`json:"host"`
Port
uint16
`json:"port"`
Timeout
int32
`json:"timeout"`
PostUrls
map
[
string
]
string
`json:"post_urls"`
}
type
GoCQWebsocketConfig
struct
{
...
...
main.go
View file @
3c04573e
...
...
@@ -96,18 +96,18 @@ func main() {
Uin
:
uin
,
Password
:
pwd
,
HttpConfig
:
&
global
.
GoCQHttpConfig
{
Enabled
:
true
,
Host
:
"0.0.0.0"
,
Port
:
5700
,
PostUrls
:
map
[
string
]
string
{},
PostMessageFormat
:
"string"
,
Enabled
:
true
,
Host
:
"0.0.0.0"
,
Port
:
5700
,
PostUrls
:
map
[
string
]
string
{},
},
WSConfig
:
&
global
.
GoCQWebsocketConfig
{
Enabled
:
true
,
Host
:
"0.0.0.0"
,
Port
:
6700
,
},
Debug
:
os
.
Getenv
(
"DEBUG"
)
==
"true"
,
PostMessageFormat
:
"string"
,
Debug
:
os
.
Getenv
(
"DEBUG"
)
==
"true"
,
}
if
post
!=
""
{
conf
.
HttpConfig
.
PostUrls
[
post
]
=
os
.
Getenv
(
"HTTP_SECRET"
)
...
...
@@ -200,11 +200,11 @@ func main() {
b
:=
coolq
.
NewQQBot
(
cli
,
conf
)
if
conf
.
HttpConfig
!=
nil
&&
conf
.
HttpConfig
.
Enabled
{
server
.
HttpServer
.
Run
(
fmt
.
Sprintf
(
"%s:%d"
,
conf
.
HttpConfig
.
Host
,
conf
.
HttpConfig
.
Port
),
conf
.
AccessToken
,
b
)
if
conf
.
HttpConfig
.
PostMessageFormat
!=
"string"
&&
conf
.
HttpConfig
.
PostMessageFormat
!=
"array"
{
if
conf
.
PostMessageFormat
!=
"string"
&&
conf
.
PostMessageFormat
!=
"array"
{
log
.
Warnf
(
"http_config.post_message_format 配置错误, 将自动使用 string"
)
coolq
.
SetMessageFormat
(
"string"
)
}
else
{
coolq
.
SetMessageFormat
(
conf
.
HttpConfig
.
PostMessageFormat
)
coolq
.
SetMessageFormat
(
conf
.
PostMessageFormat
)
}
for
k
,
v
:=
range
conf
.
HttpConfig
.
PostUrls
{
server
.
NewHttpClient
()
.
Run
(
k
,
v
,
conf
.
HttpConfig
.
Timeout
,
b
)
...
...
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