How to Make An Discord Bot Using Python

There are many ways to make an Discord Bot, But the most easy way to make a bot is by Python Programming Language

This is an simplified version of discord.py documentation which is at 👉here.

Prerequisites :

  • Discord Account(Obviously)
  • discord.py works on Python 3.5.3 or higher
    • Python 3.4 or lower non supported due to it does not have the dependencies(aiohttp)
  • Python 2.7 or lower unsupported
Installation :
  • You can get the library directly from PyPi:
    • python3 -m pip install - U discord.py
  • If you are using Windows, then the following should be used instead:
    • py -3 -m pip install -U discord.py
  • To get voice support, you should use discord.py[voice] instead of discord.py, e.g.
    • python3 -m pip install -U discord.py[voice]
  • On Linux environments, installing voice requires getting the following dependencies:
  • For a Debian-based system, the following command will get these dependencies: 
    • $ apt install libffi-dev libnacl-dev python3-dev
    • if you have some error try writing sudo at start and enter your admin password
    Virtual Environments:
            Virtual Environment is a concept of an library of Python 3.3, which helps us to use the specified different version of library for a specific project
            With help of this we don't need to update our every project for every library version update

        A more in-depth tutorial is found on Virtual Environments and Packages.
    1. Go to your project’s working directory:
      • $ cd your-bot-source $ python3 -m venv bot-env
    2. Activate the virtual environment:

      • $ source bot-env/bin/activate

      On Windows you activate it with:

      • $ bot-env\Scripts\activate.bat
    1. For a Debian-based system, the following command will get these dependencies: 
      1. $ apt install libffi-dev libnacl-dev python3-dev
      2. if you have some error try writing "sudo" at start and enter your admin password

    I Know, I Know I know that this page is full copy of the introduction page of python documentation of discord.py.

    I tried to read the full documentation for creating a disk bot, but the website is similar to (In a good sense) a dictionary rather than a guide to creating a bot.

    In Next Post I Will Try to Explain the Ways of making a bot

    No comments:

    Post a Comment