diff options
| author | Nathan Perry <avaglir@gmail.com> | 2017-07-29 17:20:43 -0400 |
|---|---|---|
| committer | Nathan Perry <avaglir@gmail.com> | 2017-07-29 17:20:43 -0400 |
| commit | deac22dffb03829216138d90e74423384b4c2c80 (patch) | |
| tree | 98c762bd0c6a80ca6a4771f1ce63764a8e7cf96a | |
| parent | b892dd48234dcbed539ddb982af4a76e81d2e8a1 (diff) | |
video enqueue works
| -rw-r--r-- | commands.go | 2 | ||||
| -rw-r--r-- | messagectx.go | 2 | ||||
| -rw-r--r-- | 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] } @@ -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()) } |
