Skip to content

Commit 27b0ca2

Browse files
committed
introduce variable for url suffix, prevents link preview
1 parent 5e0b2a5 commit 27b0ca2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,17 @@ private RestAction<Message> dmUser(MessageChannelUnion sourceChannel, ForumPost
191191
"""
192192
Hello%s 👋 You have asked a question in the wrong channel%s. Not a big deal, but none of the experts who could help you are reading your question there 🙁
193193
194-
Your question has been automatically transferred to %s , please continue there, thank you 👍
194+
Your question has been automatically transferred to %s%s, please continue there, thank you 👍
195195
""";
196196

197-
String messageForDm = messageTemplate.formatted("", " on" + " " + guild.getName(),
198-
forumPost.message.getJumpUrl());
197+
// Prevents discord from creating a distracting auto-preview for the link
198+
String jumpUrlSuffix = " ";
199+
200+
String messageForDm = messageTemplate.formatted("", " on " + guild.getName(),
201+
forumPost.message.getJumpUrl(), jumpUrlSuffix);
199202

200203
String messageOnDmFailure = messageTemplate.formatted(" " + forumPost.author.getAsMention(),
201-
"", forumPost.message.getJumpUrl());
204+
"", forumPost.message.getJumpUrl(), jumpUrlSuffix);
202205

203206
return forumPost.author.openPrivateChannel()
204207
.flatMap(channel -> channel.sendMessage(messageForDm))

0 commit comments

Comments
 (0)