prosody-docker/matterbridge/out.tengo

31 lines
804 B
Plaintext
Raw Permalink Normal View History

2024-03-01 12:50:08 +01:00
text := import("text")
fmt := import("fmt")
fmt.println(msgText)
if(inProtocol == "telegram"){
if text.index(msgText, "https") > 1 {
media_array := text.re_split(":", msgText, 2)
fmt.println(media_array)
if len(media_array) > 1 {
//TG desktop
media := text.trim_prefix(media_array[1]," ")
//msgText=media
bold := "**"+media+"**"
//link := "[link]("+media+")"
//msgText =link
msgText = text.re_replace("MEDIA", bold, msgText)
//msgText="![Tux, the Linux mascot]("+media+")"
//msgText=text.re_replace("matterbridge",msgText,"matterbridge (https://github.com/42wim/matterbridge)")
}else{
//TG android
msgText="https:"+media_array[0]
}
}
}else{
//capitalize + bold
msgUsername = "<strong>"+text.title(msgUsername)+"</strong>"
msgText = msgText
}