github.com/fumiama/NanoBot@v0.0.0-20231122134259-c22d8183efca/openapi_audio.go (about) 1 package nano 2 3 // AudioAction 音频事件 4 // 5 // https://bot.q.qq.com/wiki/develop/api/openapi/audio/model.html 6 type AudioAction struct { 7 ChannelID string `json:"channel_id"` 8 GuildID string `json:"guild_id"` 9 AudioURL string `json:"audio_url"` 10 Text string `json:"text"` 11 } 12 13 // AudioControlStatus https://bot.q.qq.com/wiki/develop/api/openapi/audio/model.html#status 14 type AudioControlStatus int 15 16 const ( 17 AudioControlStatusStart AudioControlStatus = iota 18 AudioControlStatusPause 19 AudioControlStatusResume 20 AudioControlStatusStop 21 ) 22 23 // AudioControl 控制子频道 channel_id 下的音频 24 // 25 // https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html 26 type AudioControl struct { 27 AudioURL string `json:"audio_url"` 28 Text string `json:"text"` 29 Status AudioControlStatus `json:"status"` 30 } 31 32 // ControlAudioInChannel 控制子频道 channel_id 下的音频 33 // 34 // https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html 35 func (bot *Bot) ControlAudioInChannel(id string, control *AudioControl) error { 36 return bot.PostOpenAPI("/channels/"+id+"/audio", "", &CodeMessageBase{}, WriteBodyFromJSON(control)) 37 } 38 39 // OpenMic 机器人在 channel_id 对应的语音子频道上麦 40 // 41 // https://bot.q.qq.com/wiki/develop/api/openapi/audio/put_mic.html 42 func (bot *Bot) OpenMicInChannel(id string) error { 43 return bot.PutOpenAPI("/channels/"+id+"/mic", "", &CodeMessageBase{}, nil) 44 } 45 46 // CloseMicInChannel 机器人在 channel_id 对应的语音子频道下麦 47 // 48 // https://bot.q.qq.com/wiki/develop/api/openapi/audio/delete_mic.html 49 func (bot *Bot) CloseMicInChannel(id string) error { 50 return bot.DeleteOpenAPI("/channels/"+id+"/mic", "", nil) 51 } 52 53 // AudioLiveChannelUsersChange 音视频/直播子频道成员进出事件 54 // 55 // https://bot.q.qq.com/wiki/develop/api/gateway/audio_or_live_channel_member.html 56 type AudioLiveChannelUsersChange struct { 57 GuildID string `json:"guild_id"` 58 ChannelID string `json:"channel_id"` 59 ChannelType int `json:"channel_type"` 60 UserID string `json:"user_id"` 61 }