diff options
Diffstat (limited to 'juick-xmpp')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/JuickBot.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java index bbe693a1..7a25f5d5 100644 --- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java +++ b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java @@ -524,11 +524,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { public String commandFavorites(User currentUser, Jid from, String... args) { List<Integer> mids = messagesService.getUserRecommendations(currentUser.getUid(), 0); if (mids.size() > 0) { - List<com.juick.Message> messages = messagesService.getMessages(mids); - return "Favorite messages: \n" + String.join("\n", messages.stream() - .sorted(Collections.reverseOrder()) - .map(PlainTextFormatter::formatPost) - .collect(Collectors.toList())); + return "Favorite messages: \n" + printMessages(mids, false); } return "No favorite messages, try to \"like\" something ;)"; } @@ -588,16 +584,14 @@ public class JuickBot implements StanzaListener, AutoCloseable { } } @UserCommand(pattern = "^\\@([^\\s\\n\\+]+)(\\+?)$", - help = "@username+ - Show user's info and last 10 messages (@username++ - second page, ..)") + help = "@username+ - Show user's info and last 20 messages") public String commandUser(User user, Jid from, String... arguments) { User blogUser = userService.getUserByName(arguments[0]); int page = arguments[1].length(); if (blogUser.getUid() > 0) { - List<Integer> mids = messagesService.getUserBlog(blogUser.getUid(), 0, page); - List<com.juick.Message> messages = messagesService.getMessages(mids); + List<Integer> mids = messagesService.getUserBlog(blogUser.getUid(), 0, 0); return String.format("Last messages from @%s:\n%s", arguments[0], - String.join("\n", messages.stream() - .map(PlainTextFormatter::formatPostSummary).collect(Collectors.toList()))); + printMessages(mids, false)); } return "User not found"; } |