From fe75450309a467a00454af17da0b942b36ae1de3 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 29 Mar 2020 15:38:23 +0200 Subject: [PATCH] message member on if --- rand.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rand.js b/rand.js index fed29cf..2bd537e 100644 --- a/rand.js +++ b/rand.js @@ -19,9 +19,11 @@ exports.random = function (text, message) { do { if (message) { - text = text.replace(/\[author\]/, message.author.username); - text = text.replace(/\[member\]/g, message.guild.members.cache.random().user.username); - text = text.replace(/\[memberRand\]/, message.guild.members.cache.random().user.username); + if (message.member) { + text = text.replace(/\[author\]/, message.author.username); + text = text.replace(/\[member\]/g, message.guild.members.cache.random().user.username); + text = text.replace(/\[memberRand\]/, message.guild.members.cache.random().user.username); + } } text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1)); text = text.replace(/\[kick\]/, ' ');