From deac22dffb03829216138d90e74423384b4c2c80 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sat, 29 Jul 2017 17:20:43 -0400 Subject: video enqueue works --- commands.go | 2 ++ messagectx.go | 2 -- thulani.go | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commands.go b/commands.go index 525c915..0157adb 100644 --- a/commands.go +++ b/commands.go @@ -1,5 +1,7 @@ package thulani +import "github.com/mammothbane/thulani-go/downloader" + var cmdMap = map[string]func(*messageCtx){ "help": printHelp, "skip": commandNotImplemented, diff --git a/messagectx.go b/messagectx.go index 75d6ce6..6525531 100644 --- a/messagectx.go +++ b/messagectx.go @@ -25,8 +25,6 @@ func newCtx(s *discordgo.Session, m *discordgo.MessageCreate) (*messageCtx, erro matches := regex.FindStringSubmatch(m.Content) command := "" - log.Debugf("matches: %v", matches) - if len(matches) != 0 { command = strings.Split(matches[1], " ")[0] } diff --git a/thulani.go b/thulani.go index d177f64..d4a222d 100644 --- a/thulani.go +++ b/thulani.go @@ -1,14 +1,12 @@ package thulani import ( - "math/rand" "net/url" "os" "os/signal" "regexp" "strings" "syscall" - "time" "github.com/bwmarrin/discordgo" "github.com/mammothbane/thulani-go/downloader" @@ -106,11 +104,6 @@ func onMessage(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if err := manager.Enqueue("https://www.youtube.com/watch?v=_K13GJkGvDw", time.Duration(rand.Intn(10*60))*time.Second, 5*time.Second); err != nil { - log.Errorf("unable to enqueue video: %q", err) - return - } - for _, v := range extraMemes { v(ctx) } @@ -179,4 +172,11 @@ func onMessage(s *discordgo.Session, m *discordgo.MessageCreate) { ctx.sendMessage("NO IMGUR", m.Tts) } } + + if err := manager.Enqueue(target.String(), 0, 0); err != nil { + log.Errorf("unable to enqueue video: %q", err) + ctx.sendMessage("you fucked up the video.", ctx.Tts) + return + } + log.Infof("started playing from: %q", target.String()) } -- cgit v1.3.1