fixes wrong url parse from message
This commit is contained in:
parent
60365973d8
commit
f8b1cb6d48
1 changed files with 5 additions and 3 deletions
|
@ -64,9 +64,11 @@ func containsURL(msg *gotgbot.Message) bool {
|
||||||
|
|
||||||
func getMessageURL(msg *gotgbot.Message) string {
|
func getMessageURL(msg *gotgbot.Message) string {
|
||||||
for _, entity := range msg.Entities {
|
for _, entity := range msg.Entities {
|
||||||
if entity.Type == "url" {
|
parsedEntity := gotgbot.ParseEntity(
|
||||||
return msg.Text[entity.Offset : entity.Offset+entity.Length]
|
msg.Text,
|
||||||
}
|
entity,
|
||||||
|
)
|
||||||
|
return parsedEntity.Text
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue