Open StarryGhost opened 3 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
what format is the .env file supposed to be... right now i have it as a txt file
.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
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...
oh wait i figured it out... now i have another error of the base slash command cant be intantanized
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
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
my bot is not in a server as of yet should it be?
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
uhhh now that i think of it theres no invite button is there...
how exactly do i get the bot in?
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
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?
it's okay. that would be helpful if you can send me a screenshot of the error
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
both have the same error unfortunately
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
https://drive.google.com/file/d/1wGFiAyMPwNz__Mx9cyU0DLFi3eeYbxo7/view?usp=sharing This is the base index i have made no changes to the file
is there any dependancies not listed in the instructions that i have to have?
yeah, it should have no problem tho. i did a fresh reinstall using yarn but failed to generate the same error as yours.
no, just running either yarn install or npm install should install all the dependencies that are registered in package.json.
looking at teh firsst issue thing theres the same errors and it was talking about discord.js and Node Is that possibly it?
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
how do i check if i have it and the versions
you can check your current node version using node -v
my node version is 14.17.6 i assume thats not most recent so how do i update it
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
https://nodejs.org/en/ and download the 169.1 latest features and install it again. it will automatically update your current node version
aye it started now but its permanently generating docs...
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
but the commands arnt working... AAAA
reinvite the bot with the same scope commands and you should be fine!
the bot is visibly online but non functional...
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
is there a way to restart the bot to update the file?
press Ctrl + C in the terminal and then type node . again
the commands still arnt working
it is because of the made changes. try reinviting the bot again to see if the commands arent still working
still no luck
does it matter if i start it with yarn or npm
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
uh is the guild id the server id?
and thanks for all the help
yes it is! to copy the server id you need to enable developer mode in discord setting
and thanks for all the help
don't mention it. happy to help!
ok after trying with a server id... i got a whole lotta green text
does the green text looks like this in #22 ?
yes actually
you need to add scope command like this when you invite your bot to your server
Hi i keep getting an error 'an application id must be assigned' can someone tell me what im doing wrong