From 325203cc5e23140cfe2381ae4eff34170d4d3e7f Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 23 Aug 2018 21:38:32 -0500 Subject: [PATCH] hopefully fix bot mic from staying open --- client/package-lock.json | 2 +- client/package.json | 2 +- server/bothandlers/sounds.go | 13 ++++++------- server/webserver/routes/video-archive.go | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index c402bea..3092960 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,6 +1,6 @@ { "name": "go-discord-bot", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/client/package.json b/client/package.json index ef1a3f7..7a13412 100644 --- a/client/package.json +++ b/client/package.json @@ -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", diff --git a/server/bothandlers/sounds.go b/server/bothandlers/sounds.go index 3f68605..a752c88 100644 --- a/server/bothandlers/sounds.go +++ b/server/bothandlers/sounds.go @@ -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 } diff --git a/server/webserver/routes/video-archive.go b/server/webserver/routes/video-archive.go index 334dbb4..79b13ab 100644 --- a/server/webserver/routes/video-archive.go +++ b/server/webserver/routes/video-archive.go @@ -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)