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 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 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, 10);. The snippet of code I have put above is working well.
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:
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
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
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’…
Preferably through a const such as const responses = [“response1”, “response2″, response3”] using discord.js v12.2.0. Answer
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”); …