summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authordestruc7i0n <6181960+destruc7i0n@users.noreply.github.com>2020-08-04 19:06:37 -0400
committerGitHub <noreply@github.com>2020-08-04 19:06:37 -0400
commit540db5bc3557ad3c96bea552bf746db3c5ce2ce8 (patch)
tree1ef488c03fc8cb4d981f6dc30111970c7201f844
parentMerge pull request #57 from FeikoJoosten/patch-1 (diff)
parentAdd nickname to variables obj (diff)
downloadshulker-540db5bc3557ad3c96bea552bf746db3c5ce2ce8.tar.gz
shulker-540db5bc3557ad3c96bea552bf746db3c5ce2ce8.zip
Merge pull request #59 from MarshallOliver/master
Add nickname to variables obj
Diffstat (limited to '')
-rw-r--r--src/Discord.ts2
1 files changed, 2 insertions, 0 deletions
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)
   }