Skip to content

Commit

Permalink
use refAuthor effective name if refMember is null
Browse files Browse the repository at this point in the history
Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock committed Mar 7, 2024
1 parent 9a21282 commit 952b9f1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/cc/unilock/nilcord/discord/Discord.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
Message refMessage = ref.getMessage() == null ? ref.resolve().complete() : ref.getMessage();
User refAuthor = refMessage.getAuthor();
Member refMember = refMessage.getMember();
if (refMember != null) {
reply_chunk = CONFIG.formatting.minecraft.reply_format.value()
.replace("<reply_username>", refAuthor.getName())
.replace("<reply_nickname>", refMember.getEffectiveName())
.replace("<reply_message>", refMessage.getContentDisplay())
.replace("<reply_url>", refMessage.getJumpUrl());
}
reply_chunk = CONFIG.formatting.minecraft.reply_format.value()
.replace("<reply_username>", refAuthor.getName())
.replace("<reply_nickname>", refMember == null ? refAuthor.getEffectiveName() : refMember.getEffectiveName())
.replace("<reply_message>", refMessage.getContentDisplay())
.replace("<reply_url>", refMessage.getJumpUrl());
}

String msg = CONFIG.formatting.minecraft.discord_message.value()
Expand Down

0 comments on commit 952b9f1

Please sign in to comment.