fiskenslakt / pzsd-bot

Discord bot for PZSD server
MIT License
2 stars 0 forks source link

Cog refactor #28

Closed fiskenslakt closed 4 months ago

fiskenslakt commented 4 months ago

This PR refactors the project into the much cleaner and easier to work with "cogs" structure. Our __main__.py entry point now serves to just load any and all cogs in the /cogs package, start the bot, and then clean up our db connection when it halts.

I've moved the root logger initialization to __init__.py so __main__.py and any cogs can correctly create child loggers from it, so now logs will actually show what module they're coming from. I also changed it to a rotating file handler.

I've also moved all global settings and .env loading to a settings.py module, using pydantic to load from .env and any environment variables should they exist.

This PR doesn't add any new features, but it does fix a bug I didn't realize was introduced not long ago where it was no longer possible to give points to someone by user mention (@'ing them).

I tested most of the main features and edge cases, but not all of them cuz I'm lazy. Hopefully I didn't break anything.