small pixel drawing of a pufferfish neoarkbot

Do the protection betta
j3s j3s@c3f.net
Wed, 17 Mar 2021 16:57:45 -0500
commit

a812dfcaea49c0ef76e48150e0523d89e25c2d9c

parent

99d61a5ec06c93867b8d26f9533ff95c127e9754

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

jump to
M main.gomain.go

@@ -71,12 +71,12 @@ list := strings.Join(keys, "\n")

e.Sender.Send(list) } var file string - matched, err := regexp.MatchString(`!https:\/\/(www.)?youtube\.com\/watch\?v=[A-z_0-9]{11}`, e.Message) + matched, err := regexp.MatchString(`https:\/\/(www.)?youtube\.com\/watch\?v=[A-z_0-9]{11}`, e.Message) if err != nil { fmt.Printf("regex match blew up: %s", err) return } - if matched { + if matched && strings.HasPrefix(e.Message, "!") { m := regexp.MustCompile(`https:\/\/(www.)?youtube\.com\/watch\?v=[A-z_0-9]{11}`) videoUrl := m.FindString(e.Message) fmt.Println("downloading...")

@@ -86,7 +86,6 @@ if len(parts) != 2 {

fmt.Println("youtube url is weird") return } - fmt.Println("trash") fmt.Println(parts[1]) // videoID := parts[1] videoID := parts[1]