How to I make my music bot play a finite playlist of songs?

Building further on my music bot… I’m trying to make the jump from having him play a single song, and then leave, to having him play a finite list of songs, and then leave. This should not be confused with a queue – the list of songs is predetermined and finite. It can’t be added to or changed by the bot, at least at this time. The bot DOES shuffle the list though. The problem right now is that instead of playing the songs in the list, one by one – he plays the first song, then the second… and

Client.roles.cache.size => undefined | Discord.js v12

client.roles.cache.size doesn’t seem to work for me in v12, just says that cache is undefined Any alternatives for how I can get the total number of roles the bot is currently instantiated with across all guilds? Answer Client has no property called roles. This property belongs to Guild. You can map your Guilds by roles.cache.size and get the sum of the array.

I’m having an issue with adding an “Auto-Moderating” feature on my Discord bot

G’day, I really need some help with the “Auto-Moderation” feature that I want to include in my very first Discord Bot, which is coded in JavaScript. Also, I am really new to this programming language and the discord.js itself, so I don’t really know how to use all the arguments properly. Whatever, the point is, I want my bot to analyze the messages sent by every member of my Discord Server and look out for offensive or inappropriate words in said messages. If it finds at least one, it will send a message Mentioning the member that sent said message

Discord.js Bulk Delete command

I am trying to add a bulk delete command to my bot but when I type how many messages I want to delete, I get the following error: Here’s the code: Answer To use the parseInt(), you have to add the decimal base, so 10 -> parseInt(args[0], 10);. The snippet of code I have put above is working well.

(Discord.js) TypeError: Cannot read property ‘add’ of undefined

So here’s the code: When I run the bot, I get the error: As seen on the code, I add the part where the bot would make a role as when the role is unavailable. But still, it thinks as that the role never exist. Before this was copied, I aslo wrote the code like this: And the result is still the same. I also put the bot’s role on the most top list of all roles on my test server. Can anyone find out why? I’m currently using discord.js v12 and stable version of node. Note: full code here:

Is there anyway to simulate a “Did you mean” in Java Script?

So I’m creating a bot with an API and the list is pretty case sensitive and only allowing exact matches. for example there i have this word “ENCHANTED_GLISTERING_MELON”. Its all-caps, have underscores, and complicated spelling, and the site does not accept if it is not an exact match. Its is not so user-friendly. Is there any way to so that when a user input something, it will auto capitalize, replace spaces with underscores, and most importantly check for misspells then consider the closest word? I have a dictionary of what the site accepts. Answer It not a a simple task

How can I input a number API as a string OR Where am I going to place toString()

So the code im trying to send is ( “buyPrice”:11.0 ). in the site (https://api.hypixel.net/skyblock/bazaar/product?key=a8394dae-033b-4ce5-a1a1-fb773cf2386f&productId=PORK). as you can see the value inside buyPrice is not a string but a number. and now when I send the command into discord it says “undefined”. but when I saw a code bellow that is value is a string of the same website (“warning”:”This endpoint is deprecated and will soon be disabled.”). it worked flawlessly so im thinking . .toString() but i dont know where i am going put the code in my code is: Answer This doesn’t seem to be an error in

How do I show what emojis are in the server

So I was working on a discord.js server info command. So I had an idea, of showing the emojis that are in a server, though I don’t know how to do that. I do know how to get the amount of emojis, but I’…

i need a way my bot can respond with a random response like and 8ball command

Preferably through a const such as const responses = [“response1”, “response2″, response3”] using discord.js v12.2.0. Answer

Temporary mute command returning error ‘Cannot read property ‘slice’ of undefined’

I am trying to create a temporary mute command, that will unmute the muted user in the given time. Here’s my code: const Discord = require(“discord.js”); const ms = require(“ms”); …