Androz2091 / discord-music-bot

The perfect music bot for your Discord server! 🤘
238 stars 128 forks source link

Starting the bot #48

Open StarryGhost opened 2 years ago

StarryGhost commented 2 years ago

Hi i keep getting an error 'an application id must be assigned' can someone tell me what im doing wrong

elvanz commented 2 years ago

You must assign your BOT's application ID which you can find in https://discord.com/developers/applications

Then, you have to define it in .env (DISCORD_CLIENT_ID = "yourId" and call its value to pass in const creator = new SlashCreator( applicationID = process.env.DISCORD_CLIENT_ID) on index.js

StarryGhost commented 2 years ago

what format is the .env file supposed to be... right now i have it as a txt file

elvanz commented 2 years ago

.env is already a format you just have to insert all your BOT's credentials into it. I believe there is already one .env.example right here if you fork the project, you just have to remove .example out of .env.example and then do what I said earlier

StarryGhost commented 2 years ago

im pretty new to windows and i dont know how to make it just have .env... i copied it over and originally it was an example file...

StarryGhost commented 2 years ago

oh wait i figured it out... now i have another error of the base slash command cant be intantanized

elvanz commented 2 years ago

You can do it 2 ways. First, if you are using a text editor like VS Code, you can create a new .env file directly or just rename .env.example to .env. Second, you can navigate directly to the project directory and right click New>Text Document(.txt) and rename that New Text.txt (all of them) to just .env

elvanz commented 2 years ago

oh wait i figured it out... now i have another error of the base slash command cant be intantanized

Is your bot already in a server? If it is, you have to add scope commands (oAuth2) bot and application.commands when you invite the BOT to your server

StarryGhost commented 2 years ago

my bot is not in a server as of yet should it be?

elvanz commented 2 years ago

yes, I think you should invite your bot into a server to debug and test if it works. Slash commands are only working if the bot is already in a server

StarryGhost commented 2 years ago

uhhh now that i think of it theres no invite button is there...

StarryGhost commented 2 years ago

how exactly do i get the bot in?

elvanz commented 2 years ago

navigate to discord developer portal here : https://discord.com/developers/applications and then click on your bot application that you have created. From there, you will see OAuth2(it is an url generator for your bot's invitation). Open it and tick 2 boxes in Scopes which are bot and applications.commands and on the Bot Permissions you can add anything you want for you bot. Once you're done, click on copy on the link right below Scopes options and then it will redirect you to discord.

You can find more about it here #2

StarryGhost commented 2 years ago

ok i did it and still getting the same error... sorry for all the trouble do you want me to send a screenshot or smth?

elvanz commented 2 years ago

it's okay. that would be helpful if you can send me a screenshot of the error

StarryGhost commented 2 years ago

https://drive.google.com/file/d/19Zp-zTu6JLEhJIBvKujH7Dtfq7btfzLB/view?usp=sharing

elvanz commented 2 years ago

have you tried using npm instead of yarn? if you installed the dependencies using yarn it should have no problem running yarn start but i would suggest you retry using npm to see if the error still occurs

StarryGhost commented 2 years ago

both have the same error unfortunately

elvanz commented 2 years ago

then it must have something to do with index.js where SlashCreate is not defined properly. if you can, send me a screenshot of your index.js right where you define your slashcreate class

StarryGhost commented 2 years ago

https://drive.google.com/file/d/1wGFiAyMPwNz__Mx9cyU0DLFi3eeYbxo7/view?usp=sharing This is the base index i have made no changes to the file

StarryGhost commented 2 years ago

is there any dependancies not listed in the instructions that i have to have?

elvanz commented 2 years ago

yeah, it should have no problem tho. i did a fresh reinstall using yarn but failed to generate the same error as yours.

elvanz commented 2 years ago

no, just running either yarn install or npm install should install all the dependencies that are registered in package.json.

StarryGhost commented 2 years ago

looking at teh firsst issue thing theres the same errors and it was talking about discord.js and Node Is that possibly it?

elvanz commented 2 years ago

oh yeah! i overlooked that issue lol! it has something to do with discordjs version and node.js version. make sure you have the latest discord.js version and node.js version which is 16.9.1 as i recalled

StarryGhost commented 2 years ago

how do i check if i have it and the versions

elvanz commented 2 years ago

you can check your current node version using node -v

StarryGhost commented 2 years ago

my node version is 14.17.6 i assume thats not most recent so how do i update it

elvanz commented 2 years ago

oh you are running the lts version of node.js. this repo currently only supports the newer version of discordjs(v13) which is using node.js version 16.x

elvanz commented 2 years ago

https://nodejs.org/en/ and download the 169.1 latest features and install it again. it will automatically update your current node version

StarryGhost commented 2 years ago

aye it started now but its permanently generating docs...

elvanz commented 2 years ago

i think the bot is already online! you should ignore the generating docs as it is only a console.log to notify us that the slash-commands has successfully being registered in readme.md

StarryGhost commented 2 years ago

but the commands arnt working... AAAA

elvanz commented 2 years ago

reinvite the bot with the same scope commands and you should be fine!

StarryGhost commented 2 years ago

the bot is visibly online but non functional...

elvanz commented 2 years ago

oh, have you assigned your GUILD_ID in your .env file? if you want your bot to be in multiple servers then delete DISCORD_GUILD_ID in .env and it should sync all the slash commands in each servers. if you just want to run it in a single server then you have to assign your guild(server)id in .env file

StarryGhost commented 2 years ago

is there a way to restart the bot to update the file?

elvanz commented 2 years ago

press Ctrl + C in the terminal and then type node . again

StarryGhost commented 2 years ago

the commands still arnt working

elvanz commented 2 years ago

it is because of the made changes. try reinviting the bot again to see if the commands arent still working

StarryGhost commented 2 years ago

still no luck

StarryGhost commented 2 years ago

does it matter if i start it with yarn or npm

elvanz commented 2 years ago

no both yarn start and npm start return node . so it should be fine. try reading #2 and #3 to see if you missed something

StarryGhost commented 2 years ago

uh is the guild id the server id?

StarryGhost commented 2 years ago

and thanks for all the help

elvanz commented 2 years ago

yes it is! to copy the server id you need to enable developer mode in discord setting

elvanz commented 2 years ago

and thanks for all the help

don't mention it. happy to help!

StarryGhost commented 2 years ago

ok after trying with a server id... i got a whole lotta green text

elvanz commented 2 years ago

does the green text looks like this in #22 ?

StarryGhost commented 2 years ago

yes actually

elvanz commented 2 years ago

you need to add scope command like this when you invite your bot to your server Screenshot 2021-09-20 235126