Show link flair text as tag
This commit is contained in:
parent
8b3b20210d
commit
ce9fda2b0e
@ -22,7 +22,7 @@ media = stream(subreddits)
|
|||||||
})
|
})
|
||||||
.toArray()
|
.toArray()
|
||||||
|
|
||||||
debug(jsonencode(media))
|
debug(media)
|
||||||
|
|
||||||
if (length(media) > 0) {
|
if (length(media) > 0) {
|
||||||
bot.sendMediaGroup(config.peer, media)
|
bot.sendMediaGroup(config.peer, media)
|
||||||
@ -34,7 +34,7 @@ conn.close()
|
|||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
def debug(r) {
|
def debug(r) {
|
||||||
// echo(r)
|
// echo(jsonencode(r))
|
||||||
}
|
}
|
||||||
|
|
||||||
def strToHashtag(str) =
|
def strToHashtag(str) =
|
||||||
@ -47,8 +47,10 @@ def safe(str) = str.replace("&", "&")
|
|||||||
|
|
||||||
def getCaption(post) {
|
def getCaption(post) {
|
||||||
tag = ""
|
tag = ""
|
||||||
if (length(post.flair_text) > 0) {
|
if (length(post.flair_text ?? "") > 0) {
|
||||||
tag = " #" + strToHashtag(post.sub + "_" + post.flair_text)
|
tag = " #" + strToHashtag(post.sub + "_" + post.flair_text)
|
||||||
|
} else if (length(post.link_flair_text ?? "") > 0) {
|
||||||
|
tag = " #" + strToHashtag(post.sub + "_" + post.link_flair_text)
|
||||||
}
|
}
|
||||||
return sprintf(
|
return sprintf(
|
||||||
"<a href=\"%s\">%s</a>\n" +
|
"<a href=\"%s\">%s</a>\n" +
|
||||||
|
Loading…
Reference in New Issue
Block a user