JustATac0 / GLaDOS

Code for the discord bot from this video >>> https://www.youtube.com/watch?v=EIUqm8k1VOY&lc=UgyNN_NTW5IvWNbMKYZ4AaABAg
Creative Commons Zero v1.0 Universal
15 stars 9 forks source link

i dont know how to setup lol #6

Open JadenPlaysMC569 opened 2 years ago

JadenPlaysMC569 commented 2 years ago

I want to talk to owner about on how to setup the bot but idk how to contact him so im here lol

JadenPlaysMC569 commented 2 years ago

also sorry for adding this in issues im just new here and if you guys have discord can we just message there?

kneeecaps commented 2 years ago

I'm not the owner but I've done a fair bit of work with discord bots. Its fairly easy to set up and run though it does require some basic programming experience.

First thing you need to do seems pretty basic, though you need to download the files. The only file you really need is the GLaDOS.py and the mp3 for the song. There is an mp3 for the song linked by the owner in the other issue complaining about out of sync music.

Once you have those two files, you'll want to save them somewhere, this can be anywhere though make sure the mp3 and the .py file is in the same folder.

Once you have both the folders, you'll want to make sure you have python installed. Python is one of the very few programs that it is actually worth just downloading from the microsoft store, so I would recommend just searching up python there and downloading the newest version. Off the top of my head, the newest version is 3.10.

Once you have python installed, you'll need to start installing the projects dependencies through pip. One important thing with this step, although it does not tell you this, on some computers you will need to restart the computer after installing python before pip works. To install things with pip, first you want to make sure python is installed properly. You can do this by opening any old terminal (I used powershell) and just running python --version. That should return Python 3.x.x depending on your installed version. Now to start installing what the project needs, I may have missed one or two but I think all you need is:

Please note, I may have missed one in that list, just reply here if I did and I'll try to find it for you. To install the packages, go through the list and in your terminal run the commands pip install package name so as an example, pip install discord.py. You need to run that command to install all the required packages.

The next part is possibly the hardest part out of all of this, though the bot requires a special program (ffmpeg) to convert the mp3 into something the bot can play over a voice channel. What you installed with pip was not the ffmpeg program, but instead a program telling python how to access it. You also need to install an actual exe for that. Here is a hotlink for the github page for the ffmpeg files. Download the .zip for your operating system and then extract the files somewhere. I extracted my files to C:\FFMPEG on my drive. On older machines, it is more efficient if the files are extracted to the root of your hard drive, though I don't think it matters on new machines. Now you need to add a variable to the system path, I won't explain how to do it here because there are plenty of guides online, just google "how to add variable to system path windows 10/11" or something. You need to add wherever you extracted files\bin to your path. For me, my path had C:\FFMPEG\bin added to it. When adding variables to path, be careful not to delete anything because that is very bad for your system.

After you have extracted ffmpeg and added its bin folder to your path, reopen your terminal and run the command ffmpeg. It should come up with a heap of text detailing how it was compiled and its version. If it doesn't do that, try restarting your computer, and if it still doesn't work, you have done something wrong.

Now I think this is the last step, though this is actually making your bot. You need to go to the discord developer website and make a new application. In this application, you need to the bot tab and press create bot. On that page, you can just customize your bot and do all that stuff if you want, but to invite the bot you need to go to the auth2->URL generator tab. In the list of buttons that show up, press the bot button and it will open a permissions window. It only needs permissions like send messages, connect to voice, speak and all that, but if you really don't feel like doing it you can just click administrator. I will mention though, it is a terrible idea to just go around giving bots administrator, though you can do it if you are lazy enough. Once you have done that, there is a URL at the bottom, copy and paste that and you have an invite link for your bot.

Now this is actually the last step, though it is kind of an extension of my last paragraph. You want to go back to the bot tab and click on the reset token button under the bot's name. That will return what seems to be string of random numbers but it is important, make sure to copy and paste it. You can just hit reset token again if you lose this though. With that token (token is the seemingly random letters and numbers), you need to save that into a file. It doesn't matter what the file is called, but if you want it to work without customizing the bot's code, name the file gladtoken.txt. Make sure to save this file into the same folder as the python code for the bot. Now, if you have done everything right, open your terminal again and cd into the directory you have saved the bots code, the mp3 file and the token into. You need to run one more command, python GLaDOS.py which will tell your computer to run the python code. If you have done everything right, the bot should come online in your server and the commands will work.

If you shutdown/reset your computer or close the terminal window, the bot will come offline and you will just have to run that command again to have it restart. Hope this helped you :)

My discord is kneeecaps#6866 if you need any more help with this, just say that I told you to add me on discord because I get a lot of people reporting my steam account.

EDIT: If I missed anything in my guide above, please tell me. I did this in not much time so I may have missed over a few details

JadenPlaysMC569 commented 2 years ago

Ohhh, i added the wrong token in gladtoken.txt, i added the application id

JadenPlaysMC569 commented 2 years ago

Btw you forgot to add PyNaCl

JadenPlaysMC569 commented 2 years ago

Finally it worked thanks!