ugh unicode (entities son utf-16)

This commit is contained in:
Cat /dev/Nulo 2023-05-09 20:50:34 -03:00
parent 2d02edf907
commit d1466dd415

10
main.go
View file

@ -4,7 +4,6 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"net/url"
"os" "os"
"strings" "strings"
@ -57,11 +56,10 @@ func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update)
continue continue
} }
urlString := searchMsg.Text[e.Offset : e.Offset+e.Length] url, err := e.ParseURL()
url, err := url.Parse(urlString)
if err != nil { if err != nil {
if explicit { if explicit {
bot.Send(respondWithMany(msg, "No se pudo detectar la URL ", urlString, ".")) bot.Send(respondWithMany(msg, "No se pudo detectar la URL."))
} }
continue continue
} }
@ -88,7 +86,7 @@ func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update)
} }
if explicit && érror == common.NotValid { if explicit && érror == common.NotValid {
bot.Send(respondWithMany(msg, "La URL ", urlString, " no es compatible con este bot.")) bot.Send(respondWithMany(msg, "La URL ", url.String(), " no es compatible con este bot."))
continue continue
} }
@ -97,7 +95,7 @@ func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update)
} }
if érror == common.HadError { if érror == common.HadError {
bot.Send(respondWithMany(update.Message, "Hubo un error al descargar ", urlString, ".")) bot.Send(respondWithMany(update.Message, "Hubo un error al descargar ", url.String(), "."))
continue continue
} }
} }