mcb-dev / mCodingBot

The Discord bot for the mCoding Discord server.
https://mcoding.io/discord
MIT License
12 stars 4 forks source link

Add `no_db_mode` to config.json.example, fix unhandled when `no_db_mode` is true #108

Closed Lunarmagpie closed 1 year ago

Lunarmagpie commented 1 year ago

I guess this is a little out of scope of each other but i cba to make 2 separate PRs.

This is needed because no_db_mode being false by default adds an exception that kills the bot on launcher if a postgres database isn't running.

Lunarmagpie commented 1 year ago

All the other db uses were handled in old PRs. This was missed when the highlights feature was introduced.

MithicSpirit commented 1 year ago

All the other db uses were handled in old PRs. This was missed when the highlights feature was introduced.

so things like the following fail gracefully if the database isn't available? https://github.com/mcb-dev/mCodingBot/blob/8bb548c7754b3e0a42aa756168da3983c92dfda3/mcodingbot/plugins/highlights.py#L67

Lunarmagpie commented 1 year ago

You will get an error message that the db isn't set up I believe.

MithicSpirit commented 1 year ago

Would it be possible to tell hikari to just not enable anything in the module if no_db_mode is set? maybe by just not importing it?

Lunarmagpie commented 1 year ago

definitely but it would require modules to be loaded individually

MithicSpirit commented 1 year ago

I would prefer that but it depends on what everyone else thinks (CC: @CircuitSacul @trag1c). Otherwise lgtm.

trag1c commented 1 year ago

idc

CircuitSacul commented 1 year ago

I think changing how modules are loaded is outside the scope of this pr anyways.