commit 4927f2eb2c0f0da33fb09814dc77abd08e3722bb
Author: Lucian I. Last <li@last.nl>
Date: Sun Nov 23 01:03:10 2025 +0000
diff --git a/bridge/config/config.go b/bridge/config/config.go
index d33753e..37f37c7 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -4269 +4269 @@ func GetIconURL(msg *Message, iconURL string) string {
info := strings.Split(msg.Account, ".")
protocol := info[0]
name := info[1]
- iconURL = strings.Replace(iconURL, "{NICK}", msg.Username, -1)
- iconURL = strings.Replace(iconURL, "{BRIDGE}", name, -1)
- iconURL = strings.Replace(iconURL, "{PROTOCOL}", protocol, -1)
+ iconURL = strings.ReplaceAll(iconURL, "{NICK}", msg.Username)
+ iconURL = strings.ReplaceAll(iconURL, "{BRIDGE}", name)
+ iconURL = strings.ReplaceAll(iconURL, "{PROTOCOL}", protocol)
return iconURL
}
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index 3f99da0..1c26e40 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -737 +737 @@ func (b *Bdiscord) Connect() error {
}
// if we have a User token, remove the `Bot` prefix
if strings.HasPrefix(b.GetString("Token"), "User ") {
- token = strings.Replace(b.GetString("Token"), "User ", "", -1)
+ token = strings.ReplaceAll(b.GetString("Token"), "User ", "")
}
b.c, err = discordgo.New(token)
@@ -987 +987 @@ func (b *Bdiscord) Connect() error {
if err != nil {
return err
}
- serverName := strings.Replace(b.GetString("Server"), "ID:", "", -1)
+ serverName := strings.ReplaceAll(b.GetString("Server"), "ID:", "")
b.nick = userinfo.Username
b.userID = userinfo.ID
diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go
index 49fc33b..0615fc8 100644
--- a/bridge/matrix/matrix.go
+++ b/bridge/matrix/matrix.go
@@ -5697 +5697 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content map[string]in
if url, ok = content["url"].(string); !ok {
return fmt.Errorf("url isn't a %T", url)
}
- url = strings.Replace(url, "mxc://", b.GetString("Server")+"/_matrix/media/v1/download/", -1)
+ url = strings.ReplaceAll(url, "mxc://", b.GetString("Server")+"/_matrix/media/v1/download/")
if info, ok = content["info"].(map[string]interface{}); !ok {
return fmt.Errorf("info isn't a %T", info)
diff --git a/bridge/mattermost/helpers.go b/bridge/mattermost/helpers.go
index 8dba877..e0a30d7 100644
--- a/bridge/mattermost/helpers.go
+++ b/bridge/mattermost/helpers.go
@@ -947 +947 @@ func (b *Bmattermost) apiLogin() error {
// replaceAction replace the message with the correct action (/me) code
func (b *Bmattermost) replaceAction(text string) (string, bool) {
if strings.HasPrefix(text, "*") && strings.HasSuffix(text, "*") {
- return strings.Replace(text, "*", "", -1), true
+ return strings.ReplaceAll(text, "*", ""), true
}
return text, false
}
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go
index 8e7dc7b..a601254 100644
--- a/bridge/telegram/handlers.go
+++ b/bridge/telegram/handlers.go
@@ -5759 +5759 @@ func (b *Btelegram) handleQuote(message, quoteNick, quoteMessage string) string
quoteMessage += "..."
}
}
- format = strings.Replace(format, "{MESSAGE}", message, -1)
- format = strings.Replace(format, "{QUOTENICK}", quoteNick, -1)
- format = strings.Replace(format, "{QUOTEMESSAGE}", quoteMessage, -1)
+ format = strings.ReplaceAll(format, "{MESSAGE}", message)
+ format = strings.ReplaceAll(format, "{QUOTENICK}", quoteNick)
+ format = strings.ReplaceAll(format, "{QUOTEMESSAGE}", quoteMessage)
return format
}
diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go
index a564771..3bd9f3e 100644
--- a/bridge/xmpp/xmpp.go
+++ b/bridge/xmpp/xmpp.go
@@ -3497 +3497 @@ func (b *Bxmpp) handleXMPP() error {
func (b *Bxmpp) replaceAction(text string) (string, bool) {
if strings.HasPrefix(text, "/me ") {
- return strings.Replace(text, "/me ", "", -1), true
+ return strings.ReplaceAll(text, "/me ", ""), true
}
return text, false
}
diff --git a/gateway/gateway.go b/gateway/gateway.go
index a2d572b..51d151a 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -3747 +3747 @@ func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) stri
func (gw *Gateway) modifyAvatar(msg *config.Message, dest *bridge.Bridge) string {
iconurl := dest.GetString("IconURL")
- iconurl = strings.Replace(iconurl, "{NICK}", msg.Username, -1)
+ iconurl = strings.ReplaceAll(iconurl, "{NICK}", msg.Username)
if msg.Avatar == "" {
msg.Avatar = iconurl
}