work too when message isint passed

This commit is contained in:
Loïc Bersier 2019-05-09 21:28:58 +02:00
parent 126a5e3318
commit e42edb1048

View file

@ -18,10 +18,12 @@ exports.random = function (text, message) {
});
do {
text = text.replace(/\[member\]/g, message.guild.members.random().user.username);
text = text.replace(/\[memberRand\]/, message.guild.members.random().user.username);
if (message) {
text = text.replace(/\[author\]/, message.author.username);
text = text.replace(/\[member\]/g, message.guild.members.random().user.username);
text = text.replace(/\[memberRand\]/, message.guild.members.random().user.username);
}
text = text.replace(/\[number\]/, Math.floor((Math.random() * 9) + 1));
text = text.replace(/\[author\]/, message.author.username);
text = text.replace(/\[kick\]/, ' ');
text = text.replace(/\[ban\]/, ' ');
text = text.replace(/\[delete\]/, ' ');