Originally Kody2.0, but revamped to act as boilerplate anyone can use.
pycache is an autogenerated file that we do not need to touch or worry about
cogs are a separate group of files you can write in, so that bot.py does not become one giant 50000 line file.
(OPTIONAL) myenv is a virtual environment with all of the projects dependencies (or imports). Rather than download the libraries on your PC, you will run this virtual environment from terminal
bot.py is the "brain" of the bot. all functionality will be in modules from /cogs/
.gitignore prevents the json file from being uploaded to discord, because it contains a secret token. This is if you plan to upload your bot to Github.
requirements.txt includes all the dependencies (libraries) we need
NOTE: you may also need git (https://git-scm.com/downloads) and recommended visual studio code (https://code.visualstudio.com/)
-
Make sure you have python installed. https://www.python.org/downloads/
-
Clone a copy of this repo to your system. You can do this by clicking the green "CODE" button on the main page and copying the HTTPS link, then going into a terminal and typing "git clone (PASTE_LINK_HERE). This copies all of the files to your computer.
-
Open the files in VSCode. You can do this by typing "cd .\kody2.0" in the same terminal. Then typing "code ." to open the current directory in VScode.
-
(OPTIONAL, you may skip to #4 if this looks too complicated) You should create a virtual environment to keep your dependencies consistent with others. Open a powershell terminal in VSCode
BEFORE CREATING A VIRTUAL ENVIRONMENT, YOU NEED TO ENABLE SCRIPTS ON YOUR PC. OPEN POWER SHELL IN ADMINISTRATER MODE AND TYPE "Set-ExecutionPolicy RemoteSigned"
Go back to VSCODE and open a terminal within vscode. Run "python -m venv myenv" to create your environment. If you choose to name it something else, update that in .gitignore, to prevent your virtual environment from being uploaded to github (if you choose to do that)
run "myenv/Scripts/activate" and you should notice a (myenv) prefix in your terminal. You are now using the virtual environment (very easy yes yes!)
NOTE: To leave the venv, run "deactivate". remember to use this everytime you develop
-
now run "pip install -r requirements.txt" to download all dependencies to your computer (or virtual environment if you did that)
-
Duplicate the modularization_test.py file from /cogs/. You can also refer to greetings.py. RENAME THIS FILE! KEEP THIS IN COGS! this is where you should put your code to keep things organized. you can have as many files as youd like
Follow this video (https://www.youtube.com/watch?v=zrNloK9b1ro) to create a bot in the discord developer portal (https://discord.com/developers/applications)
To create a bot, go to https://discord.com/developers/applications and click "new application". Go to the bot tab to copy the token. Also enable all three intents. To invite your bot to a server, go to OAuth2, then under "Default Authorization Link" select "In-app authorization" and check Bot and Administrator. Now under OAuth2 go to URL generator, select Bot, and administator again, and now go to the link that it provides you to add the bot to a server.
Paste your token into config.json
- To run Kody, run "python .\bot.py". You can press CTRL C to stop running it.