diff --git a/src/colorroles.js b/src/colorroles.js index 369cc51..80b3ff9 100755 --- a/src/colorroles.js +++ b/src/colorroles.js @@ -139,10 +139,10 @@ commands.color = { var role = colorRoles.findColorRole(message.member); if (!role) { if (message.member.presence.status == "offline") - return message.reply([ + return message.reply(random([ "You are offline.", "I can't change your color when you're invisible." - ].random()); + ])); else { await colorRoles.update(message.member); role = colorRoles.findColorRole(message.member); @@ -169,10 +169,10 @@ commands.title = { var role = colorRoles.findColorRole(message.member); if (!role) { if (message.member.presence.status == "offline") - return message.reply([ + return message.reply(random([ "You are offline.", "I can't change your color when you're invisible." - ].random()); + ])); else { await colorRoles.update(message.member); role = colorRoles.findColorRole(message.member); diff --git a/src/commands.js b/src/commands.js index 0747f7a..abc9d59 100755 --- a/src/commands.js +++ b/src/commands.js @@ -141,10 +141,10 @@ dClient.on('local_message', async message => { (res) => { switch (res) { case "ENOTBRIDGE": - message.channel.send([ + message.channel.send(random([ `This is not a bridged channel.`, `You can only use this command in a bridged channel.` - ].random()); + ])); break; case "EBADUSG": message.channel.send(`**Usage:** \`!${commandName} ${command.usage}\``); diff --git a/src/util.js b/src/util.js index 437869c..d8da7ef 100644 --- a/src/util.js +++ b/src/util.js @@ -1,6 +1,6 @@ -Array.prototype.random = function () { - return this[Math.floor(Math.random() * this.length)] +global.random = function (array) { + return array[Math.floor(Math.random() * array.length)] } global.sanitizeName = function sanitizeName(str){ // for showing names in discord