mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 11:33:48 +08:00
fix private rich msg.
This commit is contained in:
parent
a53e549e6c
commit
c619ee7feb
34
coolq/bot.go
34
coolq/bot.go
@ -217,6 +217,40 @@ func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) in
|
|||||||
newElem = append(newElem, fm)
|
newElem = append(newElem, fm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if i, ok := elem.(*QQMusicElement); ok {
|
||||||
|
var msgStyle uint32 = 4
|
||||||
|
if i.MusicUrl == "" {
|
||||||
|
msgStyle = 0 // fix vip song
|
||||||
|
}
|
||||||
|
bot.Client.SendFriendRichMessage(target, 100497308, 1, msgStyle, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.tencent.qqmusic",
|
||||||
|
Signature: "cbd27cd7c861227d013a25b2d10f0799",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if i, ok := elem.(*CloudMusicElement); ok {
|
||||||
|
bot.Client.SendFriendRichMessage(target, 100495085, 1, 4, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.netease.cloudmusic",
|
||||||
|
Signature: "da6b069da1e2982db3e386233f68d76d",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
return 0
|
||||||
|
}
|
||||||
newElem = append(newElem, elem)
|
newElem = append(newElem, elem)
|
||||||
}
|
}
|
||||||
m.Elements = newElem
|
m.Elements = newElem
|
||||||
|
@ -136,7 +136,7 @@ func (s *webServer) Dologin() {
|
|||||||
continue
|
continue
|
||||||
case client.SMSNeededError:
|
case client.SMSNeededError:
|
||||||
log.Warnf("账号已开启设备锁, 按下 Enter 向手机 %v 发送短信验证码.", rsp.SMSPhone)
|
log.Warnf("账号已开启设备锁, 按下 Enter 向手机 %v 发送短信验证码.", rsp.SMSPhone)
|
||||||
_, _ = s.Console.ReadString('\n')
|
readLine()
|
||||||
if !cli.RequestSMS() {
|
if !cli.RequestSMS() {
|
||||||
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
||||||
time.Sleep(time.Second * 5)
|
time.Sleep(time.Second * 5)
|
||||||
@ -151,7 +151,7 @@ func (s *webServer) Dologin() {
|
|||||||
log.Warnf("1. 向手机 %v 发送短信验证码", rsp.SMSPhone)
|
log.Warnf("1. 向手机 %v 发送短信验证码", rsp.SMSPhone)
|
||||||
log.Warnf("2. 使用手机QQ扫码验证.")
|
log.Warnf("2. 使用手机QQ扫码验证.")
|
||||||
log.Warn("请输入(1 - 2): ")
|
log.Warn("请输入(1 - 2): ")
|
||||||
text, _ = s.Console.ReadString('\n')
|
text = readLine()
|
||||||
if strings.Contains(text, "1") {
|
if strings.Contains(text, "1") {
|
||||||
if !cli.RequestSMS() {
|
if !cli.RequestSMS() {
|
||||||
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user