PythonistaGuild / TwitchIO

An Async Bot/API wrapper for Twitch made in Python.
https://twitchio.dev
MIT License
798 stars 162 forks source link

Fix module reloading incorrectly on exception #295

Closed SigmathBits closed 2 years ago

SigmathBits commented 2 years ago

Pull request summary

Currently when reloading a module, if there is an exception in Bot.load_module, such as on import, the module is improperly restored and left out of Bot._modules (since it gets removed by Bot.unload_module). This causes an issue where you can't load, unload, or reload the module again without restarting the bot. This PR fixes this issue.

Checklist

IAmTomahawkx commented 2 years ago

Please add a changelog entry, other than that looks good

SigmathBits commented 2 years ago

Alright, done! Is that sufficient?

IAmTomahawkx commented 2 years ago

lgtm, thanks