gha, Array.prototype.random broke node-rest-client

TypeError: props[propIndex].split is not a function
https://github.com/aacerox/node-rest-client/issues/154
This commit is contained in:
Lamp 2019-10-08 16:35:47 -07:00
parent 9587037109
commit 3de31864c3
3 changed files with 8 additions and 8 deletions

View File

@ -139,10 +139,10 @@ commands.color = {
var role = colorRoles.findColorRole(message.member); var role = colorRoles.findColorRole(message.member);
if (!role) { if (!role) {
if (message.member.presence.status == "offline") if (message.member.presence.status == "offline")
return message.reply([ return message.reply(random([
"You are offline.", "You are offline.",
"I can't change your color when you're invisible." "I can't change your color when you're invisible."
].random()); ]));
else { else {
await colorRoles.update(message.member); await colorRoles.update(message.member);
role = colorRoles.findColorRole(message.member); role = colorRoles.findColorRole(message.member);
@ -169,10 +169,10 @@ commands.title = {
var role = colorRoles.findColorRole(message.member); var role = colorRoles.findColorRole(message.member);
if (!role) { if (!role) {
if (message.member.presence.status == "offline") if (message.member.presence.status == "offline")
return message.reply([ return message.reply(random([
"You are offline.", "You are offline.",
"I can't change your color when you're invisible." "I can't change your color when you're invisible."
].random()); ]));
else { else {
await colorRoles.update(message.member); await colorRoles.update(message.member);
role = colorRoles.findColorRole(message.member); role = colorRoles.findColorRole(message.member);

View File

@ -141,10 +141,10 @@ dClient.on('local_message', async message => {
(res) => { (res) => {
switch (res) { switch (res) {
case "ENOTBRIDGE": case "ENOTBRIDGE":
message.channel.send([ message.channel.send(random([
`This is not a bridged channel.`, `This is not a bridged channel.`,
`You can only use this command in a bridged channel.` `You can only use this command in a bridged channel.`
].random()); ]));
break; break;
case "EBADUSG": case "EBADUSG":
message.channel.send(`**Usage:** \`!${commandName} ${command.usage}\``); message.channel.send(`**Usage:** \`!${commandName} ${command.usage}\``);

View File

@ -1,6 +1,6 @@
Array.prototype.random = function () { global.random = function (array) {
return this[Math.floor(Math.random() * this.length)] return array[Math.floor(Math.random() * array.length)]
} }
global.sanitizeName = function sanitizeName(str){ // for showing names in discord global.sanitizeName = function sanitizeName(str){ // for showing names in discord