Skip to content

Commit 7f4b08f

Browse files
committed
Add get_component
1 parent f4ed8da commit 7f4b08f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

twitchio/ext/commands/bot.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,22 @@ async def remove_component(self, name: str, /) -> Component | None:
292292

293293
return component
294294

295+
def get_component(self, name: str, /) -> Component | None:
296+
"""
297+
Retrieve a Component from the bots loaded Component.
298+
This will return `None` if the Component was not found.
299+
300+
Parameters
301+
----------
302+
name: str
303+
The name of the Component.
304+
305+
Returns
306+
-------
307+
Component | None
308+
"""
309+
return self._components.get(name)
310+
295311
def get_context(self, message: ChatMessage, *, cls: Any = None) -> Any:
296312
cls = cls or Context
297313
return cls(message, bot=self)

0 commit comments

Comments
 (0)