Skip to content

Commit

Permalink
Use sendTl to ensure message format is parsed (#5632)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Roy <[email protected]>
  • Loading branch information
mdcfe and JRoy authored Feb 4, 2024
1 parent 04c0165 commit 746627c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,24 @@ public MessageResponse sendMessage(final IMessageRecipient recipient, String mes
final MessageResponse messageResponse = recipient.onReceiveMessage(this.parent, message);
switch (messageResponse) {
case UNREACHABLE:
sendMessage(tlSender("recentlyForeverAlone", CommonPlaceholders.displayNameRecipient(recipient)));
sendTl("recentlyForeverAlone", recipient.getDisplayName());
break;
case MESSAGES_IGNORED:
sendMessage(tlSender("msgIgnore", CommonPlaceholders.displayNameRecipient(recipient)));
sendTl("msgIgnore", recipient.getDisplayName());
break;
case SENDER_IGNORED:
break;
// When this recipient is AFK, notify the sender. Then, proceed to send the message.
case SUCCESS_BUT_AFK:
// Currently, only IUser can be afk, so we unsafely cast to get the afk message.
if (((IUser) recipient).getAfkMessage() != null) {
sendMessage(tlSender("userAFKWithMessage", CommonPlaceholders.displayNameRecipient(recipient), ((IUser) recipient).getAfkMessage()));
sendTl("userAFKWithMessage", recipient.getDisplayName(), ((IUser) recipient).getAfkMessage());
} else {
sendMessage(tlSender("userAFK", CommonPlaceholders.displayNameRecipient(recipient)));
sendTl("userAFK", recipient.getDisplayName());
}
// fall through
default:
sendMessage(tlLiteral("msgFormat", AdventureUtil.parsed(tlSender("meSender")), CommonPlaceholders.displayNameRecipient(recipient), message));
sendTl("msgFormat", AdventureUtil.parsed(tlSender("meSender")), recipient.getDisplayName(), message);

// Better Social Spy
if (ess.getSettings().isSocialSpyMessages()) {
Expand Down Expand Up @@ -170,7 +170,7 @@ public MessageResponse onReceiveMessage(final IMessageRecipient sender, final St
}
}
// Display the formatted message to this recipient.
sendMessage(tlLiteral("msgFormat", CommonPlaceholders.displayNameRecipient(sender), tlSender("meRecipient"), message));
sendTl("msgFormat", sender.getDisplayName(), AdventureUtil.parsed(tlSender("meRecipient")), message);

if (isLastMessageReplyRecipient) {
// If this recipient doesn't have a reply recipient, initiate by setting the first
Expand Down

0 comments on commit 746627c

Please sign in to comment.