From 381ee40964b21f8a8c4cb9c3f84bd2ddc3290e5c Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Fri, 28 Jul 2017 03:17:55 -0400 Subject: first pass on wav --- thulani.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'thulani.go') diff --git a/thulani.go b/thulani.go index 6dfdb75..1efc67f 100644 --- a/thulani.go +++ b/thulani.go @@ -8,7 +8,10 @@ import ( "strings" "syscall" + "time" + "github.com/bwmarrin/discordgo" + "github.com/mammothbane/thulani-go/downloader" ) var config *Config @@ -99,6 +102,33 @@ func onMessage(s *discordgo.Session, m *discordgo.MessageCreate) { return } + for _, v := range ctx.Guild.Channels { + if v.Type == "voice" && v.Name == "General" { + conn, err := ctx.ChannelVoiceJoin(ctx.Guild.ID, v.ID, false, false) + if err != nil { + log.Errorf("unable to join voice channel: %q", err) + break + } + + ch, err := downloader.Download("https://www.youtube.com/watch?v=_K13GJkGvDw", 10*time.Second, 10*time.Second) + if err != nil { + log.Errorf("unable to download video") + break + } + + conn.Speaking(true) + go func() { + defer conn.Speaking(false) + + for i := range ch { + conn.OpusSend <- i + } + }() + + break + } + } + for _, v := range extraMemes { v(ctx) } -- cgit v1.3.1