Skip to content

Commit

Permalink
Add asyncio event to all plugins sayign whether or not they are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
4Kaylum committed Mar 19, 2024
1 parent e5a49f0 commit e910d73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions novus/ext/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ async def _add_plugin_load(self, plugin: Plugin) -> None:

try:
await plugin.on_load()
plugin.loaded.set()
except Exception as e:
self.plugins.remove(plugin)
log.error(f"Failed to load plugin {plugin} via on_load", exc_info=e)
Expand Down
1 change: 1 addition & 0 deletions novus/ext/client/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def __new__(cls, *args: Any, **kwargs: Any) -> Any:
def __init__(self, bot: Client) -> None:
self.bot: Client = bot
self.log = log.getChild(self.__class__.__name__)
self.loaded = asyncio.Event()

@property
def state(self) -> n.HTTPConnection:
Expand Down

0 comments on commit e910d73

Please sign in to comment.