1
0

dockerfile but the image is planet-sized

This commit is contained in:
2021-01-27 20:41:47 +01:00
parent a47f6b2df1
commit 3b443c2001
4 changed files with 58 additions and 83 deletions

View File

@ -10,10 +10,10 @@ import (
)
// playSound plays the current buffer to the provided channel.
func playSound(s *discordgo.Session, guildID, channelID string, buffer []byte) (err error) {
func playSound(s *discordgo.Session, guildID, channelID string, audioBuffer []byte) (err error) {
// Join the provided voice channel.
vc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)
vc, err := s.ChannelVoiceJoin(guildID, channelID, false, false)
if err != nil {
log.Println("Could not find channel.")
return err
@ -25,13 +25,14 @@ func playSound(s *discordgo.Session, guildID, channelID string, buffer []byte) (
// Start speaking.
vc.Speaking(true)
vc.OpusSend <- buffer
log.Println(len(audioBuffer))
vc.OpusSend <- audioBuffer
// Stop speaking
vc.Speaking(false)
// Sleep for a specificed amount of time before ending.
time.Sleep(250 * time.Millisecond)
time.Sleep(5000 * time.Millisecond)
// Disconnect from the provided voice channel.
vc.Disconnect()