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
05d8e773
Commit
05d8e773
authored
Sep 03, 2020
by
scjtqs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配合 最新的MiraiGo调整代码
parent
b2f46b4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
coolq/cqcode.go
coolq/cqcode.go
+10
-2
docs/cqhttp.md
docs/cqhttp.md
+1
-0
No files found.
coolq/cqcode.go
View file @
05d8e773
...
@@ -503,11 +503,19 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
...
@@ -503,11 +503,19 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
template
:=
CQCodeEscapeValue
(
d
[
"data"
])
template
:=
CQCodeEscapeValue
(
d
[
"data"
])
//println(template)
//println(template)
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
msg
:=
message
.
New
XmlMsg
(
template
,
i
)
msg
:=
message
.
New
RichXml
(
template
,
i
)
return
msg
,
nil
return
msg
,
nil
case
"json"
:
case
"json"
:
resId
:=
d
[
"resid"
]
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
log
.
Warnf
(
"json msg=%s"
,
d
[
"data"
])
log
.
Warnf
(
"json msg=%s"
,
d
[
"data"
])
msg
:=
message
.
NewJsonMsg
(
CQCodeUnescapeValue
(
d
[
"data"
]))
if
i
==
0
{
//默认情况下走小程序通道
msg
:=
message
.
NewLightApp
(
CQCodeUnescapeValue
(
d
[
"data"
]))
return
msg
,
nil
}
//resid不为0的情况下走富文本通道,后续补全透传service Id,此处暂时不处理 TODO
msg
:=
message
.
NewRichJson
(
CQCodeUnescapeValue
(
d
[
"data"
]))
return
msg
,
nil
return
msg
,
nil
default
:
default
:
return
nil
,
errors
.
New
(
"unsupported cq code: "
+
t
)
return
nil
,
errors
.
New
(
"unsupported cq code: "
+
t
)
...
...
docs/cqhttp.md
View file @
05d8e773
...
@@ -179,6 +179,7 @@ Type: `json`
...
@@ -179,6 +179,7 @@ Type: `json`
| 参数名 | 类型 | 说明 |
| 参数名 | 类型 | 说明 |
| ------ | ------ | ------------------------------------------------------------ |
| ------ | ------ | ------------------------------------------------------------ |
| data | string | json内容,json的所有字符串记得实体化处理|
| data | string | json内容,json的所有字符串记得实体化处理|
| resid | int32 | 默认不填为0,走小程序通道,填了走富文本通道发送|
json中的字符串需要进行转义:
json中的字符串需要进行转义:
...
...
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