Hi, so i wanted to make a music bot, i watched some youtube videos and made this code: My prefix is "." so i did example .play www.youtube.com/watch?v=64aA-Qj5ZcE&index=1&list=PLsT3RTb9cPkPv-cfpKPvgkJswvvadbgRL but nothing happen, nothing at all.... I check the command promt(terminal) to see the errors, but there is non... Can anyone help me please?
I don't know any JavaScript but I'm going to reply anyway. First of all, is your script even active? Add a simple alert("hello this is working") to your script to test if it even works. Assuming the script is active and everything else works; In your script it says: Then the next line you do I don't see the var named prefix anywhere in the code so I'm going to assume it's some built-in Discord thing. I'm gonna go ahead and guess that "startsWith(config)" is the culprit and it should be "startsWith(prefix)". The script probably stops there, you can check by adding an alert before and after that line, it'll only show the first alert.
(And here I thought Harry was the only one doing code stuff for the server) I don't know much about discord bots (and this seems to be more discord-specific than JavaScript specific), but going along with what Jerry said, adding in little output statements at various points in your code to see which sections of code are being run will help. Sometimes the error is that the code you want never runs in the first place, and sometimes the problem is an infinite loop that won't stop running. Output statements should show you if something like that is happening, and if so, where. I've only begun taking courses in Javascript this semester, but I can pretty safely tell you that it's not the optimal language for discord stuff. Since I don't know the ins and outs of discord, I can't really help you any more than that. Good luck!
I've tried it, all the other commands works, but when it to the codes under "ping" it doesn't work, but ping works...
Nvm, i fixed it, the problem was that i typed config " if (!message.content.startsWith(config)) return; " but it was supose to be " if (!message.content.startsWith(config.prefix)) return; " and the same thing with " var args = message.content.substring(prefix.length).split(" "); " it was supose to be " var args = message.content.substring(config.prefix.length).split(" "); "