Compare commits

..

2 commits

Author SHA1 Message Date
0356a5c0c7
Switched from nitter.privacydev to nitter.poast
Their instance seems to work a lot more often
2024-06-16 15:40:35 -06:00
a6384e362e
Fixed false regex matches for Twitter 2024-06-16 15:39:25 -06:00

View file

@ -38,7 +38,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
respond := false respond := false
for _, url := range urls { for _, url := range urls {
if output, _ := regexp.MatchString("(http.*twitter.com/.*/status)|(http.*t.co/.*)|(http.*x.com/.*)", url); output { if output, _ := regexp.MatchString("(http.*twitter.com/.*/status)|(http.*t.co/.*)|(http.*x.com/.*/status)", url); output {
log.Println("Cringe twitter post detected.") log.Println("Cringe twitter post detected.")
if shortned, _ := regexp.MatchString("http.*t.co/.*", url); shortned { if shortned, _ := regexp.MatchString("http.*t.co/.*", url); shortned {
@ -52,7 +52,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
} }
} }
response.Content = response.Content + fmt.Sprintf("\n<%s>", regexp.MustCompile("(http.*twitter.com)|(http.*x.com)").ReplaceAllString(url, "https://nitter.privacydev.net")) response.Content = response.Content + fmt.Sprintf("\n<%s>", regexp.MustCompile("(http.*twitter.com)|(http.*x.com)").ReplaceAllString(url, "https://nitter.poast.org"))
result, err := goutubedl.New(context.Background(), url, goutubedl.Options{}) result, err := goutubedl.New(context.Background(), url, goutubedl.Options{})
if err != nil { if err != nil {