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
cd09a68e
Commit
cd09a68e
authored
Sep 22, 2020
by
wdvxdr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
parent
d2d408a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
35 deletions
+3
-35
coolq/cqcode.go
coolq/cqcode.go
+3
-35
No files found.
coolq/cqcode.go
View file @
cd09a68e
...
@@ -338,41 +338,9 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
...
@@ -338,41 +338,9 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
return
nil
,
errors
.
New
(
"private voice unsupported now"
)
return
nil
,
errors
.
New
(
"private voice unsupported now"
)
}
}
f
:=
d
[
"file"
]
f
:=
d
[
"file"
]
var
data
[]
byte
data
,
err
:=
global
.
FindFile
(
f
,
d
[
"cache"
],
global
.
VOICE_PATH
)
if
strings
.
HasPrefix
(
f
,
"http"
)
||
strings
.
HasPrefix
(
f
,
"https"
)
{
if
err
!=
nil
{
b
,
err
:=
global
.
GetBytes
(
f
)
return
nil
,
err
if
err
!=
nil
{
return
nil
,
err
}
data
=
b
}
if
strings
.
HasPrefix
(
f
,
"base64"
)
{
b
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
strings
.
ReplaceAll
(
f
,
"base64://"
,
""
))
if
err
!=
nil
{
return
nil
,
err
}
data
=
b
}
if
strings
.
HasPrefix
(
f
,
"file"
)
{
fu
,
err
:=
url
.
Parse
(
f
)
if
err
!=
nil
{
return
nil
,
err
}
if
strings
.
HasPrefix
(
fu
.
Path
,
"/"
)
&&
runtime
.
GOOS
==
`windows`
{
fu
.
Path
=
fu
.
Path
[
1
:
]
}
b
,
err
:=
ioutil
.
ReadFile
(
fu
.
Path
)
if
err
!=
nil
{
return
nil
,
err
}
data
=
b
}
if
global
.
PathExists
(
path
.
Join
(
global
.
VOICE_PATH
,
f
))
{
b
,
err
:=
ioutil
.
ReadFile
(
path
.
Join
(
global
.
VOICE_PATH
,
f
))
if
err
!=
nil
{
return
nil
,
err
}
data
=
b
}
}
if
!
global
.
IsAMRorSILK
(
data
)
{
if
!
global
.
IsAMRorSILK
(
data
)
{
return
nil
,
errors
.
New
(
"unsupported voice file format (please use AMR file for now)"
)
return
nil
,
errors
.
New
(
"unsupported voice file format (please use AMR file for now)"
)
...
...
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