I’m trying to check if there is an id of the participant who entered the server, and then if it is there, ban him. But it gives me an error
allmember.forEach is not a function
Code:
bot.on('guildMemberAdd', (member) => {
const allmember = db.get(`abig_${member.guild.id}`)
allmember.forEach(element => {
if(member.id == element) {
member.ban()
}
})
})
Maybe it’s a problem with forEach, check this website
There is a big difference, I use quick.db, and it’s almost impossible to find such
Martin
#4
Well here is what you can do:
const banlistArray = db.has(message.author.id + '.banlist')
if(banlistArray){
member.ban()
}
Change variables and code to fit with yours. This may not be 100% correct since I’m on mobile. Try it and let me know what errors you get.
1 Like
Thanks for the answer, but I need to get all the ids from the array, and check if there is an id of the participant who logged into the server
Martin
#6
But shouldn’t my code do the same thing? Also change db.has(message.author.id + '.banlist')
to db.has(member + '.banlist')
Thanks for the answer. But I found another solution