Skip to content

Commit 13cd43d

Browse files
committed
add plugins inference
1 parent b586442 commit 13cd43d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/wechaty/plugin.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import socket
3636
from typing import (
3737
TYPE_CHECKING,
38+
Iterable,
3839
List,
3940
Optional,
4041
Dict,
@@ -601,6 +602,15 @@ def add_plugin(self, plugin: Union[str, WechatyPlugin]) -> None:
601602
# TODO(wj-Mcat): disable this event hook
602603
# await plugin_instance.on_loaded()
603604

605+
def plugins(self) -> Iterable[WechatyPlugin]:
606+
"""get all of registered plugins
607+
608+
Returns:
609+
List[WechatyPlugin]: the list of wechaty plugins
610+
"""
611+
for plugin in self._plugins.values():
612+
yield plugin
613+
604614
def remove_plugin(self, name: str) -> None:
605615
"""remove plugin"""
606616
if name not in self._plugins:
@@ -682,7 +692,7 @@ async def start(self) -> None:
682692
# if len(routes_txt) == 0:
683693
# log.warning(
684694
# 'there is not registed blueprint in the plugins, '
685-
# 'so bot will not start the web service'
695+
# 'so bot will not start the web service'
686696
# )
687697
# return
688698

0 commit comments

Comments
 (0)