diff options
author | destruc7i0n <6181960+destruc7i0n@users.noreply.github.com> | 2020-06-03 12:59:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 12:59:51 -0400 |
commit | 0147bc91f464d54fee44668f239d2d5a58cc233e (patch) | |
tree | 9a9863d99bc349a93cce41678e9a01585f42a2f7 | |
parent | backwards compat with new option (diff) | |
parent | Fixed user mention detection (diff) | |
download | shulker-0147bc91f464d54fee44668f239d2d5a58cc233e.tar.gz shulker-0147bc91f464d54fee44668f239d2d5a58cc233e.zip |
Merge pull request #54 from TheZackCodec/tellraw_regex_improvement
Improved regex for user mentions and TELLRAW
-rw-r--r-- | src/Discord.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Discord.ts b/src/Discord.ts index 2893c8b..ffdd05b 100644 --- a/src/Discord.ts +++ b/src/Discord.ts @@ -140,13 +140,13 @@ class Discord { } return this.config.MINECRAFT_TELLRAW_TEMPLATE - .replace('%username%', variables.username) - .replace('%discriminator%', variables.discriminator) - .replace('%message%', variables.text) + .replace(/%username%/g, variables.username) + .replace(/%discriminator%/g, variables.discriminator) + .replace(/%message%/g, variables.text) } private replaceDiscordMentions(message: string): string { - const possibleMentions = message.match(/@(\S+)/gim) + const possibleMentions = message.match(/@*.*#[0-9]{4}/gim) if (possibleMentions) { for (let mention of possibleMentions) { const mentionParts = mention.split('#') |