Compare commits

...

2 commits

Author SHA1 Message Date
a526c21484
Added new weird youtube.com URL 2023-11-15 19:22:27 -07:00
58ff7e8edf
Added x.com support 2023-11-15 19:22:09 -07:00

View file

@ -38,7 +38,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
respond := false
for _, url := range urls {
if output, _ := regexp.MatchString("(http.*twitter.com/.*/status)|(http.*t.co/.*)", url); output {
if output, _ := regexp.MatchString("(http.*twitter.com/.*/status)|(http.*t.co/.*)|(http.*x.com/.*)", url); output {
log.Println("Cringe twitter post detected.")
if shortned, _ := regexp.MatchString("http.*t.co/.*", url); shortned {
@ -89,10 +89,10 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
}
respond = true
} else if output, _ := regexp.MatchString("(http.*youtube.com/watch.*?v=.*)|(http.*youtube.com/shorts/.*)|(http.*youtu.be/.*)", url); output {
} else if output, _ := regexp.MatchString("(http.*youtube.com/watch.*?v=.*)|(http.*youtube.com/shorts/.*)|(http.*youtube.com/v/.*)|(http.*youtu.be/.*)", url); output {
log.Println("YouTube detected.")
if shortned, _ := regexp.MatchString("http.*youtu\\.be/.*", url); shortned {
if shortned, _ := regexp.MatchString("(http.*youtu\\.be/.*)|(http.*youtube.com/v/.*)", url); shortned {
var err error
log.Println("Short URL detected. Getting long version.")