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\]/, ' ');