Skip to content
This repository was archived by the owner on Jan 17, 2024. It is now read-only.

Commit 44211d5

Browse files
authored
Merge pull request #48 from sysnapse/voice-silk
use back upload group ppt
2 parents 8d84316 + 2714154 commit 44211d5

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

cmd/voice.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,10 @@ func voiceGenshin(args []string, source *command.MessageSource) error {
4242
if err != nil {
4343
return err
4444
}
45-
46-
/*
47-
voice, err := qq.NewVoiceByBytes(data)
48-
if err != nil {
49-
return err
50-
}
51-
*/
52-
53-
voice := &message.VoiceElement{Data: data}
45+
voice, err := qq.NewVoiceByBytes(data)
46+
if err != nil {
47+
return err
48+
}
5449
return qq.SendGroupMessage(message.NewSendingMessage().Append(voice))
5550
}
5651

qq/msg.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ func NewTts(text string) (*message.GroupVoiceElement, error) {
3838
return NewTtsWithGroup(ValGroupInfo.Uin, text)
3939
}
4040

41-
func NewVoiceByUrl(url string) (*message.VoiceElement, error){
41+
func NewVoiceByUrl(url string) (*message.GroupVoiceElement, error){
4242
data, err := request.GetBytesByUrl(url)
4343
if err != nil{
4444
return nil, err
4545
}
4646
return NewVoiceByBytes(data)
4747
}
4848

49-
func NewVoiceByBytes(b []byte) (*message.VoiceElement, error){
50-
return &message.VoiceElement{Data: b}, nil
49+
func NewVoiceByBytes(b []byte) (*message.GroupVoiceElement, error){
50+
return NewVoiceByBytesWithGroup(ValGroupInfo.Uin, b)
5151
}
5252

5353
func NewVoiceByBytesWithGroup(gp int64, b []byte) (*message.GroupVoiceElement, error){

qq/sending.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ func GetRandomMessageByTry(try int) []*message.TextElement {
210210
random, err := GetRandomGroupMessage(ValGroupInfo.Uin)
211211

212212
if try > 2 { // 發送多一則隨機消息
213-
for _, element := range GetRandomMessageByTry(1) { // 使用 1 確保不無限套娃
214-
extras = append(extras, element)
215-
}
213+
// 使用 1 確保不無限套娃
214+
extras = append(extras, GetRandomMessageByTry(1)...)
216215
}
217216

218217
if err == nil && random != nil {

0 commit comments

Comments
 (0)