PJB3005 / MoMMI

Old SS14 Discord server bot.
MIT License
12 stars 29 forks source link

Added irc module system #3

Closed ComicIronic closed 7 years ago

ComicIronic commented 7 years ago

Extended module loaded in modules.py to be more generically usable. Added irc module for doing mention transformations between discord/irc. Added irc functionality to do discord mentions through @nick@ syntax.

ComicIronic commented 7 years ago

Untested, obviously, but the compiler didn't complain. @@ closing is lazy, so having a third @ won't break your message hard - anyone with one in their name on Discord can't be mentioned from IRC, though, unless we want to do escaping, which I don't.

PJB3005 commented 7 years ago

Doesn't seem like a reload would correctly cause the sub modules to reload though, because python will keep the sub modules in memory and won't reload them unless explicitly told to via importlib.

Personally I think having modules load and manage submodules themselves is overly complex. The method I used everywhere else where everything is registered to relevant event dispatchers via decorators works better (I do have to solve the problem of resetting lists made by decorators on reload cleanly, though), because it's more explicit, flexible, and can convey more data cleanly. Allowing clean (re)loading of recursive directories should be added though for organization.

ComicIronic commented 7 years ago

I've updated with a decorator implementation.