From 017d0fd2b78e93cff65ed6e517d8ce7e95279c15 Mon Sep 17 00:00:00 2001 From: Marshall Oliver Date: Tue, 4 Aug 2020 15:42:25 -0400 Subject: Add nickname to variables obj To use, add %nickname% to your MINCRAFT_TELLRAW_TEMPLATE var in config. --- src/Discord.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/Discord.ts b/src/Discord.ts index ffdd05b..bb3b9a2 100644 --- a/src/Discord.ts +++ b/src/Discord.ts @@ -131,6 +131,7 @@ class Discord { private makeMinecraftTellraw(message: Message): string { const variables: {[index: string]: string} = { username: emojiStrip(message.author.username), + nickname: message.member.nickname ? emojiStrip(message.member.nickname) : emojiStrip(message.author.username), discriminator: message.author.discriminator, text: emojiStrip(message.cleanContent) } @@ -141,6 +142,7 @@ class Discord { return this.config.MINECRAFT_TELLRAW_TEMPLATE .replace(/%username%/g, variables.username) + .replace(/%nickname%/g, variables.nickname) .replace(/%discriminator%/g, variables.discriminator) .replace(/%message%/g, variables.text) } -- cgit 1.4.1