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