T
T
TBlare2020-05-10 07:49:30
JavaScript
TBlare, 2020-05-10 07:49:30

TypeError: val.array is not a function at Object.bot.findMember / What's the problem?

Hosted the bot's discord, discord.js/Node.JS( link to git )

On the test discord servers, it functions normally, but on the main server with more than 1000 participants, it cannot capture (add / remove in the channel) the user.

Error log:

TypeError: val.array is not a function
    at Object.bot.findMember (/app/bot_modules/general/module.js:32:31)
    at /app/bot_modules/rooms/commands/add.js:36:28

module.js: 32:31:
var val = guild.members.find(val => val.displayName.includes(userid));
if( val != null) { if(val.array().length == 1){ return val; } }

add.js:36:28:
var mentions = message.mentions.members.array();
var mentionroles = message.mentions.roles.array();
var resolvables = message.cleanContent.split(" ");

//resolve flat names to fake mentions or explode
for(var i = 0; i < resolvables.length; i++){
    if(bot.findMember(resolvables[i], message.guild) != null){
        mentions.push(bot.findMember(resolvables[i], message.guild));
    }
}

What is the problem? Why does it only occur on a large server?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question