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
5024cc08
Commit
5024cc08
authored
Sep 05, 2020
by
scjtqs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂存
parent
6565a19a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
124 deletions
+161
-124
coolq/api.go
coolq/api.go
+6
-6
coolq/bot.go
coolq/bot.go
+1
-0
coolq/cqcode.go
coolq/cqcode.go
+153
-118
go.sum
go.sum
+1
-0
No files found.
coolq/api.go
View file @
5024cc08
...
...
@@ -119,7 +119,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
}
if
m
,
ok
:=
i
.
(
gjson
.
Result
);
ok
{
if
m
.
Type
==
gjson
.
JSON
{
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
)
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
,
groupId
)
fixAt
(
elem
)
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
if
mid
==
-
1
{
...
...
@@ -144,7 +144,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
if
autoEscape
{
elem
=
append
(
elem
,
message
.
NewText
(
str
))
}
else
{
elem
=
bot
.
ConvertStringMessage
(
str
,
true
)
elem
=
bot
.
ConvertStringMessage
(
str
,
true
,
groupId
)
}
fixAt
(
elem
)
mid
:=
bot
.
SendGroupMessage
(
groupId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
...
...
@@ -187,7 +187,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
}
return
m
[
"time"
]
.
(
int32
)
}(),
Message
:
bot
.
ConvertStringMessage
(
m
[
"message"
]
.
(
string
),
true
),
Message
:
bot
.
ConvertStringMessage
(
m
[
"message"
]
.
(
string
),
true
,
groupId
),
})
return
}
...
...
@@ -196,7 +196,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
}
uin
,
_
:=
strconv
.
ParseInt
(
e
.
Get
(
"data.uin"
)
.
Str
,
10
,
64
)
name
:=
e
.
Get
(
"data.name"
)
.
Str
content
:=
bot
.
ConvertObjectMessage
(
e
.
Get
(
"data.content"
),
true
)
content
:=
bot
.
ConvertObjectMessage
(
e
.
Get
(
"data.content"
),
true
,
groupId
)
if
uin
!=
0
&&
name
!=
""
&&
len
(
content
)
>
0
{
var
newElem
[]
message
.
IMessageElement
for
_
,
elem
:=
range
content
{
...
...
@@ -242,7 +242,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
var
str
string
if
m
,
ok
:=
i
.
(
gjson
.
Result
);
ok
{
if
m
.
Type
==
gjson
.
JSON
{
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
)
elem
:=
bot
.
ConvertObjectMessage
(
m
,
true
,
userId
)
mid
:=
bot
.
SendPrivateMessage
(
userId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
if
mid
==
-
1
{
return
Failed
(
100
)
...
...
@@ -265,7 +265,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
if
autoEscape
{
elem
=
append
(
elem
,
message
.
NewText
(
str
))
}
else
{
elem
=
bot
.
ConvertStringMessage
(
str
,
false
)
elem
=
bot
.
ConvertStringMessage
(
str
,
false
,
userId
)
}
mid
:=
bot
.
SendPrivateMessage
(
userId
,
&
message
.
SendingMessage
{
Elements
:
elem
})
if
mid
==
-
1
{
...
...
coolq/bot.go
View file @
5024cc08
...
...
@@ -259,3 +259,4 @@ func (m MSG) ToJson() string {
b
,
_
:=
json
.
Marshal
(
m
)
return
string
(
b
)
}
coolq/cqcode.go
View file @
5024cc08
This diff is collapsed.
Click to expand it.
go.sum
View file @
5024cc08
...
...
@@ -35,6 +35,7 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
...
...
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