1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-09 08:32:48 +00:00

hopefully fix bot mic from staying open

This commit is contained in:
2018-08-23 21:38:32 -05:00
parent 94bac26903
commit 325203cc5e
4 changed files with 9 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "go-discord-bot",
"version": "0.7.0",
"version": "0.7.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "go-discord-bot",
"version": "0.7.0",
"version": "0.7.1",
"description": "Client for go-discord-bot",
"scripts": {
"build": "NODE_ENV=prod webpack -p --progress --colors",

View File

@@ -204,6 +204,9 @@ func (conn *AudioConnection) playAudio(soundName string, m *discordgo.MessageCre
func (conn *AudioConnection) playSoundsInQueue() {
conn.toggleSoundPlayingLock(true)
// Start speaking.
_ = conn.VoiceConnection.Speaking(true)
for {
select {
case newSoundName := <-conn.SoundQueue:
@@ -212,21 +215,17 @@ func (conn *AudioConnection) playSoundsInQueue() {
return
}
// Start speaking.
_ = conn.VoiceConnection.Speaking(true)
// Send the buffer data.
for _, buff := range conn.Sounds[newSoundName].Content {
conn.VoiceConnection.OpusSend <- buff
}
// Stop speaking
_ = conn.VoiceConnection.Speaking(false)
// Sleep for a specificed amount of time before ending.
time.Sleep(50 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
default:
// Stop speaking
_ = conn.VoiceConnection.Speaking(false)
conn.toggleSoundPlayingLock(false)
return
}

View File

@@ -101,7 +101,7 @@ func postVideoArchivesHandler(c *gin.Context) {
return
}
hostURL := "[Click here to see the full archive!](http://" + c.Request.Host + "/video-archive)"
hostURL := "[Click here to see the full archive!](https://" + c.Request.Host + "/video-archive)"
youtubeURL := "https://youtu.be/" + videoArchive.YoutubeID
bot.SendEmbeddedNotification(videoArchive.Title, "**"+videoArchive.UploadedBy+"** archived a new video:\n"+youtubeURL+"\n\n"+hostURL)