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
c854339b
Commit
c854339b
authored
Aug 08, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update voice.
parent
b61fe4e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
3 deletions
+7
-3
coolq/bot.go
coolq/bot.go
+1
-1
coolq/cqcode.go
coolq/cqcode.go
+3
-1
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
No files found.
coolq/bot.go
View file @
c854339b
...
...
@@ -99,7 +99,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
newElem
=
append
(
newElem
,
gm
)
continue
}
if
i
,
ok
:=
elem
.
(
*
message
.
Group
VoiceElement
);
ok
{
if
i
,
ok
:=
elem
.
(
*
message
.
VoiceElement
);
ok
{
gv
,
err
:=
bot
.
Client
.
UploadGroupPtt
(
groupId
,
i
.
Data
,
int32
(
len
(
i
.
Data
)))
if
err
!=
nil
{
log
.
Warnf
(
"警告: 群 %v 消息语音上传失败: %v"
,
groupId
,
err
)
...
...
coolq/cqcode.go
View file @
c854339b
...
...
@@ -44,6 +44,8 @@ func ToStringMessage(e []message.IMessageElement, code int64, raw ...bool) (r st
r
+=
fmt
.
Sprintf
(
"[CQ:forward,id=%s]"
,
o
.
ResId
)
case
*
message
.
FaceElement
:
r
+=
fmt
.
Sprintf
(
`[CQ:face,id=%d]`
,
o
.
Index
)
case
*
message
.
VoiceElement
:
r
+=
fmt
.
Sprintf
(
`[CQ:record,file=%s]`
,
o
.
Name
)
case
*
message
.
ImageElement
:
if
ur
{
r
+=
fmt
.
Sprintf
(
`[CQ:image,file=%s]`
,
o
.
Filename
)
...
...
@@ -283,7 +285,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
if
!
global
.
IsAMR
(
data
)
{
return
nil
,
errors
.
New
(
"unsupported voice file format (please use AMR file for now)"
)
}
return
&
message
.
Group
VoiceElement
{
Data
:
data
},
nil
return
&
message
.
VoiceElement
{
Data
:
data
},
nil
case
"face"
:
id
,
err
:=
strconv
.
Atoi
(
d
[
"id"
])
if
err
!=
nil
{
...
...
go.mod
View file @
c854339b
...
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-202008080
03732-2a32e623270d
github.com/Mrs4s/MiraiGo v0.0.0-202008080
44635-cd20d7d43dbb
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2
github.com/guonaihong/gout v0.1.1
...
...
go.sum
View file @
c854339b
...
...
@@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200807030850-ed30f7ad5934 h1:LoNjIsnyEQFGP9Ich
github.com/Mrs4s/MiraiGo v0.0.0-20200807030850-ed30f7ad5934/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d h1:K9jHdcO13mLqQB0xm0/ZlY852FoVQJ/WSDwfdmfhDlU=
github.com/Mrs4s/MiraiGo v0.0.0-20200808003732-2a32e623270d/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb h1:XLe/UreYJRT65GStA3+irRL1Ao0pHZwBtCmTc+4prwA=
github.com/Mrs4s/MiraiGo v0.0.0-20200808044635-cd20d7d43dbb/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
...
...
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