mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-09 16:42:48 +00:00
hopefully fix bot mic from staying open
This commit is contained in:
2
client/package-lock.json
generated
2
client/package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "go-discord-bot",
|
"name": "go-discord-bot",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "go-discord-bot",
|
"name": "go-discord-bot",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"description": "Client for go-discord-bot",
|
"description": "Client for go-discord-bot",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=prod webpack -p --progress --colors",
|
"build": "NODE_ENV=prod webpack -p --progress --colors",
|
||||||
|
|||||||
@@ -204,6 +204,9 @@ func (conn *AudioConnection) playAudio(soundName string, m *discordgo.MessageCre
|
|||||||
func (conn *AudioConnection) playSoundsInQueue() {
|
func (conn *AudioConnection) playSoundsInQueue() {
|
||||||
conn.toggleSoundPlayingLock(true)
|
conn.toggleSoundPlayingLock(true)
|
||||||
|
|
||||||
|
// Start speaking.
|
||||||
|
_ = conn.VoiceConnection.Speaking(true)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case newSoundName := <-conn.SoundQueue:
|
case newSoundName := <-conn.SoundQueue:
|
||||||
@@ -212,21 +215,17 @@ func (conn *AudioConnection) playSoundsInQueue() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start speaking.
|
|
||||||
_ = conn.VoiceConnection.Speaking(true)
|
|
||||||
|
|
||||||
// Send the buffer data.
|
// Send the buffer data.
|
||||||
for _, buff := range conn.Sounds[newSoundName].Content {
|
for _, buff := range conn.Sounds[newSoundName].Content {
|
||||||
conn.VoiceConnection.OpusSend <- buff
|
conn.VoiceConnection.OpusSend <- buff
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop speaking
|
|
||||||
_ = conn.VoiceConnection.Speaking(false)
|
|
||||||
|
|
||||||
// Sleep for a specificed amount of time before ending.
|
// Sleep for a specificed amount of time before ending.
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Stop speaking
|
||||||
|
_ = conn.VoiceConnection.Speaking(false)
|
||||||
conn.toggleSoundPlayingLock(false)
|
conn.toggleSoundPlayingLock(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func postVideoArchivesHandler(c *gin.Context) {
|
|||||||
return
|
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
|
youtubeURL := "https://youtu.be/" + videoArchive.YoutubeID
|
||||||
bot.SendEmbeddedNotification(videoArchive.Title, "**"+videoArchive.UploadedBy+"** archived a new video:\n"+youtubeURL+"\n\n"+hostURL)
|
bot.SendEmbeddedNotification(videoArchive.Title, "**"+videoArchive.UploadedBy+"** archived a new video:\n"+youtubeURL+"\n\n"+hostURL)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user