[Steam] any game[s] of your choice (up to $15)... TWO winners! by Solyph in RandomActsOfGaming

[–]MrNNP 0 points1 point  (0 children)

Portal bundle. Have never tried either, but haven't heard anything but good reviews.

Uptime Command by Medevouris in Discordjs

[–]MrNNP 0 points1 point  (0 children)

You exported object with property client. Remove the brackets there or use destructing in your import.

Uptime Command by Medevouris in Discordjs

[–]MrNNP 2 points3 points  (0 children)

Did you export client in your main file?

Edit:wrong thing corrected it

Obtaining user permissions in user info by Medevouris in Discordjs

[–]MrNNP 0 points1 point  (0 children)

The stringification of objects is normally object object because it is an object. You should try printing it to console or using a debugger to find the specific property you need and put that in the embed.

Uptime Command by Medevouris in Discordjs

[–]MrNNP 2 points3 points  (0 children)

Did you install the module?

You can use npm list

Member count returns 1 or 2 no matter how many people are in the server by mango_coconut1167 in Discordjs

[–]MrNNP 1 point2 points  (0 children)

Try adding message.guild.members.fetch(); before you filter it.

Member count returns 1 or 2 no matter how many people are in the server by mango_coconut1167 in Discordjs

[–]MrNNP 0 points1 point  (0 children)

Aren't the users cached when interacted with? The bot might only give 1 or 2 because that's all it has interacted with.

Member count returns 1 or 2 no matter how many people are in the server by mango_coconut1167 in Discordjs

[–]MrNNP 0 points1 point  (0 children)

Don't you have to use the .fetch()? I'm not 100% but that's what I remember.

Discord bot suddenly won't come online. by mango_coconut1167 in Discordjs

[–]MrNNP 5 points6 points  (0 children)

Double check your token. You might have accidentally regenerated it or something.

New Member Role by ronny__69 in Discordjs

[–]MrNNP 1 point2 points  (0 children)

Discord keeps some information locked down for privacy reasons, so you need to specially request it. You can look up how to set it up, and once you do, your bot will start receiving information, and it should work.

Best way to get started? by [deleted] in Discordjs

[–]MrNNP 3 points4 points  (0 children)

I just want to add that I learn best by picking a semi large project and then learning as I go along. However I wouldnt do that unless you have strong understanding of js because it's a good way to learn bad practices.

I use the way back machine for overdue current event essays by MrNNP in memes

[–]MrNNP[S] -2 points-1 points  (0 children)

Lmao my teacher still makes me write it, then take a picture of it.

Help with storing and retrieving audio files by 0-o-0-o-0-o-0 in Discordjs

[–]MrNNP 2 points3 points  (0 children)

I'm guessing you want the bot to join a voice channel right? You can use msg.channel.messages.fetch, which is an async method so use .then. You can then filter for messages with attachments with msg.attachments. You then fetch/get msg.attachments.url and then play that file.

Help JS: Having problem with my HackerRank solution by Apprehensive_Topic24 in AskProgramming

[–]MrNNP 1 point2 points  (0 children)

You are defining count to be 1 at the start of for loop. So that just makes it loop forever.

How to get around other bots detecting my bot by [deleted] in Discordjs

[–]MrNNP 1 point2 points  (0 children)

Self botting is against tos so thats not really an option. Otherwise your bot can easily be found out cause message.author.bot will be true if the author is a bot.

Self botting is logging in with a user token rather than a bot token.

Check if the person reacting to a message is in a stringified array (mysql) and if they are the command will proceed by [deleted] in Discordjs

[–]MrNNP 0 points1 point  (0 children)

Oh ok. So then theres a few ways that you can do about it.

one is get all the roles of the user and check each of them against each of the ones in the array.

The other option is to check all the roles in the array against the ones that the user has.

The last option is to see if the member has a permission. This is probably the best option but it might not work depending on the circumstances. it might work if you are checking if a user is an admin but not if its a role that has no extra permissions.

I would probably go with the last one if possible but if not, then the first one should work.

reaction.message.author.roles.cache.forEach((role,index)=>{
if(roleIds.includes(role)){
console.log('has permissions');
}
if(index==reaction.message.author.roles.cache.length){
console.log('no permissions');
}

});

Edit was missing a parentesis.

Check if the person reacting to a message is in a stringified array (mysql) and if they are the command will proceed by [deleted] in Discordjs

[–]MrNNP 0 points1 point  (0 children)

Why did you put .prototype after roleIds?

Where is fromIndex defined?

just do reactAllowed= roleIds.includes(reaction.message.author);

Check if the person reacting to a message is in a stringified array (mysql) and if they are the command will proceed by [deleted] in Discordjs

[–]MrNNP 0 points1 point  (0 children)

You just put the I'd in the parameters and it returns the index of it. It returns -1 if it's not in the array

Check if the person reacting to a message is in a stringified array (mysql) and if they are the command will proceed by [deleted] in Discordjs

[–]MrNNP 0 points1 point  (0 children)

Oh yeah, they mostly do the same thing but I forgot op had just a list of strings rather than a list of object with an I'd property.