Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-02-03 17:45:47 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-02-04 01:15:55 +0300
commit9d724d34e1cf0c6cf118fb092d737d2f84d67a60 (patch)
tree81291afb546fd5f6068b17d36e6769cabe7f6e52
parent618a5662837b0c70a88782ccb47e1cb634241bb3 (diff)
fix tgbot - no warning for empty socks5
-rw-r--r--web/service/tgbot.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/web/service/tgbot.go b/web/service/tgbot.go
index 4ffa7bb4..0b5a8158 100644
--- a/web/service/tgbot.go
+++ b/web/service/tgbot.go
@@ -115,14 +115,19 @@ func (t *Tgbot) Start(i18nFS embed.FS) error {
}
func (t *Tgbot) NewBot(token string, proxyUrl string) (*telego.Bot, error) {
- if proxyUrl == "" || !strings.HasPrefix(proxyUrl, "socks5://") {
- logger.Warning("invalid socks5 url, start with default")
+ if proxyUrl == "" {
+ // No proxy URL provided, use default instance
+ return telego.NewBot(token)
+ }
+
+ if !strings.HasPrefix(proxyUrl, "socks5://") {
+ logger.Warning("Invalid socks5 URL, starting with default")
return telego.NewBot(token)
}
_, err := url.Parse(proxyUrl)
if err != nil {
- logger.Warning("cant parse proxy url, use default instance for tgbot:", err)
+ logger.Warning("Can't parse proxy URL, using default instance for tgbot:", err)
return telego.NewBot(token)
}