diff --git a/redditimages.own b/redditimages.own index 5cb361e..23c8172 100644 --- a/redditimages.own +++ b/redditimages.own @@ -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( "%s\n" +