Skip to content

Commit

Permalink
remove urls from the text
Browse files Browse the repository at this point in the history
if no text is left, add a witty message
  • Loading branch information
Blundell committed Oct 25, 2017
1 parent 3403d40 commit b79d87c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ private String generateImageUrl(ChannelHistory.Message message) {
}

private String generateText(ChannelHistory.Message message) {
return message.getText()
String text = message.getText()
.replaceAll("<h", "h")
.replaceAll("/>", "")
.replaceAll(">", "")
.replaceAll("\\?(.*)", "");
.replaceAll("\\?(.*)", "")
.replaceAll("(http|https)://(.*)", "");
if(text.isEmpty()) {
return "I was so excited by this #enews, I didn't have time to write anything. Check it out!";
}
return text;
}

private String generateTitle(ChannelHistory.Message message) {
Expand Down

0 comments on commit b79d87c

Please sign in to comment.