aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-12 11:46:40 +0300
committerGravatar Vitaly Takmazov2023-01-12 11:56:11 +0300
commite377357b00cdb151aa20d96a0ce7a5f1a8bbe9c9 (patch)
tree8e776a6705e71eb72e8ea48bb3d345bc0e96fa6c /src/main/java/com/juick/CommandsManager.java
parent84f6e27f7e563bcb58815575546c52c944f0cd3e (diff)
Telegram: parse_mode=html
Diffstat (limited to 'src/main/java/com/juick/CommandsManager.java')
-rw-r--r--src/main/java/com/juick/CommandsManager.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/juick/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java
index 6b33cf16..e01e5020 100644
--- a/src/main/java/com/juick/CommandsManager.java
+++ b/src/main/java/com/juick/CommandsManager.java
@@ -65,6 +65,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
/**
@@ -93,6 +94,8 @@ public class CommandsManager {
private ApplicationEventPublisher applicationEventPublisher;
@Inject
private WebApp webApp;
+ @Value("${web_domain:localhost}")
+ private String webDomain;
@Inject
private ActivityPubManager activityPubManager;
@@ -160,7 +163,7 @@ public class CommandsManager {
SystemActivity.message(user, msg, subscriptionService.getSubscribedUsers(msg.getUser().getUid(), msg))));
return CommandResult.build(msg,
"New message posted.\n#" + msg.getMid() + " https://juick.com/m/" + msg.getMid(),
- String.format("[New message](%s) posted", PlainTextFormatter.formatUrl(msg)));
+ String.format("<a href='%s'>New message</a> posted", PlainTextFormatter.formatUrl(msg)));
}
@UserCommand(pattern = "^ping$", patternFlags = Pattern.CASE_INSENSITIVE,
@@ -455,7 +458,7 @@ public class CommandsManager {
return CommandResult.fromString(replies.stream()
.map(PlainTextFormatter::formatPostSummary).collect(Collectors.joining("\n")));
}
- return CommandResult.fromString(PlainTextFormatter.formatPost(msg.get()));
+ return CommandResult.fromString(PlainTextFormatter.formatPost(msg.get(), webDomain));
}
return CommandResult.fromString("Message not found");
}
@@ -465,7 +468,7 @@ public class CommandsManager {
int rid = NumberUtils.toInt(arguments[1], 0);
Message reply = messagesService.getReply(mid, rid);
if (reply != null) {
- return CommandResult.fromString(PlainTextFormatter.formatPost(reply));
+ return CommandResult.fromString(PlainTextFormatter.formatPost(reply, webDomain));
}
return CommandResult.fromString("Reply not found");
}
@@ -596,7 +599,7 @@ public class CommandsManager {
subscriptionService.getUsersSubscribedToComments(original, reply))));
return CommandResult.build(reply, "Reply posted.\n#" + mid + "/" + newrid + " "
+ "https://juick.com/m/" + mid + "#" + newrid,
- String.format("[Reply](%s) posted", PlainTextFormatter.formatUrl(reply)));
+ String.format("<a href='%s'>Reply</a> posted", PlainTextFormatter.formatUrl(reply)));
} else {
return CommandResult.fromString("Message is read-only");
}