sfirfi / Bug-Bomber-600

DEPRECATED Discord Bot.
6 stars 5 forks source link

Suggest to have a database class to simplify database operations #4

Closed SuperSajuuk closed 6 years ago

SuperSajuuk commented 6 years ago

The bot currently creates multiple connections to the same database in different files. This can be problematic and is not really necessary when the bot is only in one server. Simplifying this with a database class that provides all operations will make things easier and only need you to instantiate the class to a variable and then do deferred imports with the db variable as needed.

Here's an example of my bot's database class using PyMySQL. If you were to use it, you'd need to update the yield from references and the like to be in matching with your existing code for await etc: https://github.com/SajuukBot/SajuukBot/blob/py-dev/python/class_database.py

I was asked to make this ticket to remind AEnterprise, hopefully this will help the bot :)

AEnterprise commented 6 years ago

this was added and merged into master with #5