Do the protection betta
j3s j3s@c3f.net
Wed, 17 Mar 2021 16:57:45 -0500
1 files changed,
2 insertions(+),
3 deletions(-)
jump to
M
main.go
→
main.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]