Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting the bot #48

Open
StarryGhost opened this issue Sep 18, 2021 · 62 comments
Open

Starting the bot #48

StarryGhost opened this issue Sep 18, 2021 · 62 comments

Comments

@StarryGhost
Copy link

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

@elvanz
Copy link

elvanz commented Sep 19, 2021

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
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

.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
Copy link
Author

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
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

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

@StarryGhost
Copy link
Author

how exactly do i get the bot in?

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

StarryGhost commented Sep 20, 2021

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
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

both have the same error unfortunately

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

StarryGhost commented Sep 20, 2021

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
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

StarryGhost commented Sep 20, 2021

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

how do i check if i have it and the versions

@elvanz
Copy link

elvanz commented Sep 20, 2021

you can check your current node version using node -v

@StarryGhost
Copy link
Author

StarryGhost commented Sep 20, 2021

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

the bot is visibly online but non functional...

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

the commands still arnt working

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

still no luck

@StarryGhost
Copy link
Author

does it matter if i start it with yarn or npm

@elvanz
Copy link

elvanz commented Sep 20, 2021

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
Copy link
Author

uh is the guild id the server id?

@StarryGhost
Copy link
Author

and thanks for all the help

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

and thanks for all the help

don't mention it. happy to help!

@StarryGhost
Copy link
Author

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

@elvanz
Copy link

elvanz commented Sep 20, 2021

does the green text looks like this in #22 ?

@StarryGhost
Copy link
Author

yes actually

@elvanz
Copy link

elvanz commented Sep 20, 2021

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

@StarryGhost
Copy link
Author

those are the scope commands that i added

@StarryGhost
Copy link
Author

@elvanz
Copy link

elvanz commented Sep 20, 2021

it should already work. if you already added scope commands & also defined GUILD_ID in .env file it should sync slash-commands in your server

@elvanz
Copy link

elvanz commented Sep 20, 2021

maybe try to restart the bot again?

@StarryGhost
Copy link
Author

... now i get the application id must be defined...

@elvanz
Copy link

elvanz commented Sep 20, 2021

oh gosh xD! how could this happened again.. you made sure you filled in all the credentials in .env file, right?

@StarryGhost
Copy link
Author

aaaaaa the commands started registering again... the music isnt playing tho... it joined but no sound

@elvanz
Copy link

elvanz commented Sep 20, 2021

have you already installed ffmpeg? if yes, #12 said that you have to install opusscript because of a missing dependency

@StarryGhost
Copy link
Author

i just have to install ffmpeg with git r?

@elvanz
Copy link

elvanz commented Sep 20, 2021

better to install ffmpeg-static instead by typing yarn add ffmpeg-static or npm install --save ffmpeg-static (choose your own preference whether to use npm or yarn)

@StarryGhost
Copy link
Author

AAA ITS WORKING TYSM

@elvanz
Copy link

elvanz commented Sep 20, 2021

happy to help!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants