Commit 030eb6b7 authored by wdvxdr's avatar wdvxdr

feature support [CQ:tts]

parent 6b706ca3
......@@ -364,6 +364,15 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
return nil, errors.New("invalid gift id")
}
return &GiftElement{Target: t, GiftId: GiftId[id]}, nil
case "tts":
if !group {
return nil, errors.New("private voice unsupported now")
}
data, err := bot.Client.GetTts(d["text"])
if err != nil {
return nil, err
}
return &message.VoiceElement{Data: data}, nil
case "record":
if !group {
return nil, errors.New("private voice unsupported now")
......
......@@ -287,6 +287,22 @@ Type: `cardimage`
[CQ:cardimage,file=https://i.pixiv.cat/img-master/img/2020/03/25/00/00/08/80334602_p0_master1200.jpg]
```
### 文本转语音
> 注意:通过TX的TTS接口,采用的音源与登录账号的性别有关
Type: `tts`
范围: **发送(仅群聊)**
参数:
| 参数名 | 类型 | 说明 |
| ------ | ------ | ----------- |
| text | string | 内容 |
示例: `[CQ:tts,text=这是一条测试消息]`
## API
### 设置群名
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment