discord-bot

Discord Bot

Discord Python MySQL Docker

Simple discord bot that can give you quotes and handle your todo tasks

Technologies Used

Features

  • Connects to a Discord Server
  • Can give nice quotes
  • Manage your To-Do tasks (CRUD):
    • Create a task
    • Read a task
    • Update a task
    • Delete a task
  • Runs on Docker for easier execution

Screenshots

hello

quote

view-empty

add

select

update

view

delete

clear

Setup

To run this project, here are the requirements:

  • Docker
  • Python (3.9)
  • MySQL
  • Discord Bot setup (You can follow this guide)

To play around with the code please use PyCharm to open this project.

Usage

Docker

To run this project, you can use docker!

First off, create a .env file (use the .env.example for reference)

Next, simply use this command to run the application:

docker-compose up

You will then see something similar to this:

...
discord-bot |                       INFO     connecting to database discord on        db.py:10
discord-bot |                                mysql:3306 as user root
discord-bot |                       INFO     creating table todo                      db.py:21
discord-bot | [2022-11-12 08:46:08] [INFO    ] discord.client: logging in using static token
discord-bot |                       INFO     logging in using static token       client.py:571
discord-bot | [2022-11-12 08:46:11] [INFO    ] discord.gateway: Shard ID None has connected to Gateway (Session ID: ---).
discord-bot | [2022/11/12 08:46;11] INFO     Shard ID None has connected to     gateway.py:560
discord-bot |                                Gateway (Session ID:
discord-bot |                                ----).
discord-bot | [2022/11/12 08:46;13] INFO     We have logged in as mhasan01-bot#--- main.py:15

PyCharm

To run it locally, you can also use PyCharm.

Make sure you make the .env first and configure the DB correctly.

  • To run the application, you can execute the main.py (there should be a green indicator to execute it)
  • To run the tests, you can click right on the folder tests and run the tests.

Room for Improvement

Room for improvement:

  • Add more functionality.
  • More OOP classes could be implemented in the object.
  • Add CI / CD for build / lint / test pipeline.
  • Handle errors more gracefully

Acknowledgements

  • FreeCodeCamp
  • Various codes on the internet
  • StackOverflow answers

Contact

Created by mhasan01 – feel free to contact me!

Visit original content creator repository https://github.com/muhammadhasan01/discord-bot

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *