Migrate deployment to Gitea Actions and Portainer
Build and Push Container / docker (push) Successful in 24m19s
Build and Push Container / docker (push) Successful in 24m19s
This commit is contained in:
@@ -5,8 +5,9 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
neturl "net/url"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"github.com/dustinpianalto/discordgo"
|
||||
)
|
||||
|
||||
func CleanAmazonURLs(s *discordgo.Session, message *discordgo.MessageCreate) {
|
||||
@@ -25,14 +26,11 @@ func CleanAmazonURLs(s *discordgo.Session, message *discordgo.MessageCreate) {
|
||||
if len(urls) != 0 {
|
||||
|
||||
for _, url := range urls {
|
||||
if strings.Contains(url, "ref=") || strings.Contains(url, "?") {
|
||||
parts := strings.Split(url, "/")
|
||||
new := strings.Join(parts[:len(parts)-1], "/")
|
||||
if strings.Contains(new, "ref=") {
|
||||
parts = strings.Split(new, "ref=")
|
||||
new = parts[0]
|
||||
}
|
||||
content = strings.ReplaceAll(content, url, new)
|
||||
u, _ := neturl.Parse(url)
|
||||
u.RawQuery = ""
|
||||
u.Fragment = ""
|
||||
if ( url != u.String() ) {
|
||||
content = strings.ReplaceAll(content, url, u.String())
|
||||
}
|
||||
}
|
||||
_, err := sendWebhook(s, message, message.ChannelID, content)
|
||||
|
||||
Reference in New Issue
Block a user