small pixel drawing of a pufferfish neoarkbot

Ensure list works, make vol control
root root@atlanta.j3s.sh
Wed, 19 Jan 2022 04:57:33 +0000
commit

94cecded360d50df8e979eedf7a9926a647b58c8

parent

01a575d799c6fe67b2a8945c94536f05d11cd60e

1 files changed, 19 insertions(+), 2 deletions(-)

jump to
M main.gomain.go

@@ -9,6 +9,7 @@ "path/filepath"

"regexp" "sort" "strings" + "strconv" "github.com/kkdai/youtube/v2" "layeh.com/gumble/gumble"

@@ -56,6 +57,20 @@ fmt.Println("stopping")

stream.Stop() return } + volmatched, err := regexp.MatchString(`^vol [0-9]+$`, e.Message) + if err != nil { + fmt.Printf("regex match blew up: %s", err) + return + } + if volmatched { + r := regexp.MustCompile(`[0-9]+`) + vol := r.FindString(e.Message) + vol64, _ := strconv.ParseFloat(vol, 32) + vol32 := float32(vol64) + truevol := vol32 / 100.0 + stream.Volume = truevol + return + } if e.Message == "list" { // send list to sender fmt.Println("listing")

@@ -67,8 +82,10 @@ }

keys = append(keys, k) } sort.Strings(keys) - list := strings.Join(keys, "<br>") - e.Sender.Send(list) + listone := strings.Join(keys[:200], "<br>") + listtwo := strings.Join(keys[201:], "<br>") + e.Sender.Send(listone) + e.Sender.Send(listtwo) } var file string matched, err := regexp.MatchString(`https:\/\/(www.)?youtube\.com\/watch\?v=[A-z_\-0-9]{11}`, e.Message)