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
03cc0dba
Commit
03cc0dba
authored
Aug 24, 2020
by
scjtqs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移动xml处理位置
parent
8874ed03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
26 deletions
+7
-26
coolq/cqcode.go
coolq/cqcode.go
+7
-26
No files found.
coolq/cqcode.go
View file @
03cc0dba
...
...
@@ -196,22 +196,6 @@ func (bot *CQBot) ConvertStringMessage(m string, group bool) (r []message.IMessa
}
}
}
if
(
t
==
"xml"
){
//xml需要实体化,发送的时候不能转回去
x
:=
make
(
map
[
string
]
string
)
//循环遍历Map
for
_
,
p
:=
range
ps
{
x
[
p
[
1
]]
=
p
[
2
]
}
resId
:=
x
[
"resid"
]
template
:=
x
[
"data"
]
println
(
template
)
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
msg
:=
global
.
NewXmlMsg
(
template
,
i
)
r
=
append
(
r
,
msg
)
continue
}
elem
,
err
:=
bot
.
ToElement
(
t
,
d
,
group
)
if
err
!=
nil
{
log
.
Warnf
(
"转换CQ码到MiraiGo Element时出现错误: %v 将原样发送."
,
err
)
...
...
@@ -252,16 +236,6 @@ func (bot *CQBot) ConvertObjectMessage(m gjson.Result, group bool) (r []message.
}
}
}
if
t
==
"xml"
{
//xml需要实体化,发送的时候不能转回去
resId
:=
e
.
Get
(
"data"
)
.
Get
(
"resid"
)
.
Str
template
:=
e
.
Get
(
"data"
)
.
Get
(
"data"
)
.
Str
println
(
template
)
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
msg
:=
global
.
NewXmlMsg
(
template
,
i
)
r
=
append
(
r
,
msg
)
return
}
d
:=
make
(
map
[
string
]
string
)
e
.
Get
(
"data"
)
.
ForEach
(
func
(
key
,
value
gjson
.
Result
)
bool
{
d
[
key
.
Str
]
=
value
.
Str
...
...
@@ -483,6 +457,13 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
},
nil
}
return
nil
,
errors
.
New
(
"unsupported music type: "
+
d
[
"type"
])
case
"xml"
:
resId
:=
d
[
"resid"
]
template
:=
CQCodeEscapeValue
(
d
[
"data"
])
println
(
template
)
i
,
_
:=
strconv
.
ParseInt
(
resId
,
10
,
64
)
msg
:=
global
.
NewXmlMsg
(
template
,
i
)
return
msg
,
nil
default
:
return
nil
,
errors
.
New
(
"unsupported cq code: "
+
t
)
}
...
...
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