Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# Discord ChatBot
**main.py** will be the file you run in order to start the bot.
In order to make things easier to understand, we'll divide the features of the chatbot into more functions that are located in different modules (files).
For example: in order for the bot to respond to your "!hello", the main.py file imports the function named
*basicFunctions* from the basicFunctionsFile module.
This way, not only won't we have an endless main.py module but we will also be able to work individually on various
features within our own modules and once completed, simply import them in main.py with a single line of code.
**botClient.py** is required for the bot to run, it basically makes the variable *client* (which happens to be used
literally everywhere in our code) connect our code to Discord (or something like that I guess).
So for every new module/file you create, don't forget to add ``from botClient import client``.
# Requirements:
Get PyCharm, get pip and the rest of the libraries, **PYTHON 3.6.6** (3.7 has problems with discord lib)
https://github.com/Rapptz/discord.py (Download it, also check the README, it has instructions on how to install)
### Update to the new discord.py 1.0 lib (rewrite ver.)
Make sure you get the latest version of discord.py! Not 0.16, but 1.0 (REWRITE)
In order to do this, upgrade your pip from 10 to 18 using ``python -m pip install --upgrade pip`` in command prompt.
After that, use the command ``python -m pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]`` in PyCharm Terminal.
Note that the latest version of discord.py (rewrite) has some changes, it's almost like an entirely different library.
Even so, it's better if we make the change now while we will learn than later.
Here is the documentation:
https://discordpy.readthedocs.io/en/rewrite/migrating.html
Basically you're gonna have this open in a tab at all times, it's pretty much a manual
Even the way you send messages has been changed:
https://discordpy.readthedocs.io/en/rewrite/migrating.html#migrating-1-0-sending-messages
Also, the discord.py 1.0 REWRITE library is new, it's been scheduled to fully release on 2018/11/01. This means that most video guides on YouTube will require most of the commands to be converted to discord.py 1.0 (from 0.16).
Important Links:
-----------------------------------------------------------------------
https://discordpy.readthedocs.io/en/rewrite/migrating.html - Discord.py 1.0 rewrite migrating
https://discordpy.readthedocs.io/en/latest/faq.html - Discord.py FAQ
https://discordpy.readthedocs.io/en/rewrite/ext/commands/commands.html - Discord.py commands docs
https://discordpy.readthedocs.io/en/rewrite/api.html - Discord.py API docs
https://discordapp.com/developers/docs/resources/channel - Official Discord API docs
https://docs.python.org/3/library/functions.html - Python integrated functions
https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/ - Python context managers explanation
https://aiohttp.readthedocs.io/en/stable/client_reference.html - Aiohttp Client Ref. Docs
https://realpython.com/python-json/#a-very-brief-history-of-json - JSON explanation
https://docs.python.org/3/library/json.html - JSON docs
https://www.json.org/ - Official JSON page explanation
https://www.w3schools.com/python/python_mysql_getstarted.asp - MySQL Python Guide
https://www.makeuseof.com/tag/important-sql-commands-programmer-know/ - Some MySQL commands
-----------------------------------------------------------------------
Tutorials:
-----------------------------------------------------------------------
https://www.digitaltrends.com/gaming/how-to-make-a-discord-bot \
https://www.devdungeon.com/content/make-discord-bot-python \
https://www.devdungeon.com/content/make-discord-bot-python-part-2 \
https://www.devdungeon.com/content/ai-chat-bot-python-aiml