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
b290a0a5
Commit
b290a0a5
authored
Aug 14, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to fix group image upload failed. #65
parent
edf6180e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
coolq/bot.go
coolq/bot.go
+1
-1
main.go
main.go
+6
-6
No files found.
coolq/bot.go
View file @
b290a0a5
...
@@ -94,7 +94,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
...
@@ -94,7 +94,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
var
newElem
[]
message
.
IMessageElement
var
newElem
[]
message
.
IMessageElement
for
_
,
elem
:=
range
m
.
Elements
{
for
_
,
elem
:=
range
m
.
Elements
{
if
i
,
ok
:=
elem
.
(
*
message
.
ImageElement
);
ok
{
if
i
,
ok
:=
elem
.
(
*
message
.
ImageElement
);
ok
{
gm
,
err
:=
bot
.
Client
.
UploadGroupImage
(
groupId
,
i
.
Data
)
gm
,
err
:=
bot
.
Client
.
UploadGroupImage
(
114514
,
i
.
Data
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Warnf
(
"警告: 群 %v 消息图片上传失败: %v"
,
groupId
,
err
)
log
.
Warnf
(
"警告: 群 %v 消息图片上传失败: %v"
,
groupId
,
err
)
continue
continue
...
...
main.go
View file @
b290a0a5
...
@@ -198,14 +198,14 @@ func main() {
...
@@ -198,14 +198,14 @@ func main() {
global
.
Check
(
cli
.
ReloadGroupList
())
global
.
Check
(
cli
.
ReloadGroupList
())
log
.
Infof
(
"共加载 %v 个群."
,
len
(
cli
.
GroupList
))
log
.
Infof
(
"共加载 %v 个群."
,
len
(
cli
.
GroupList
))
b
:=
coolq
.
NewQQBot
(
cli
,
conf
)
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
.
PostMessageFormat
!=
"string"
&&
conf
.
PostMessageFormat
!=
"array"
{
if
conf
.
PostMessageFormat
!=
"string"
&&
conf
.
PostMessageFormat
!=
"array"
{
log
.
Warnf
(
"http_config.
post_message_format 配置错误, 将自动使用 string"
)
log
.
Warnf
(
"
post_message_format 配置错误, 将自动使用 string"
)
coolq
.
SetMessageFormat
(
"string"
)
coolq
.
SetMessageFormat
(
"string"
)
}
else
{
}
else
{
coolq
.
SetMessageFormat
(
conf
.
PostMessageFormat
)
coolq
.
SetMessageFormat
(
conf
.
PostMessageFormat
)
}
}
if
conf
.
HttpConfig
!=
nil
&&
conf
.
HttpConfig
.
Enabled
{
server
.
HttpServer
.
Run
(
fmt
.
Sprintf
(
"%s:%d"
,
conf
.
HttpConfig
.
Host
,
conf
.
HttpConfig
.
Port
),
conf
.
AccessToken
,
b
)
for
k
,
v
:=
range
conf
.
HttpConfig
.
PostUrls
{
for
k
,
v
:=
range
conf
.
HttpConfig
.
PostUrls
{
server
.
NewHttpClient
()
.
Run
(
k
,
v
,
conf
.
HttpConfig
.
Timeout
,
b
)
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