Skip to content

Commit

Permalink
Add get_component
Browse files Browse the repository at this point in the history
  • Loading branch information
chillymosh committed Nov 9, 2024
1 parent f4ed8da commit 7f4b08f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions twitchio/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,22 @@ async def remove_component(self, name: str, /) -> Component | None:

return component

def get_component(self, name: str, /) -> Component | None:
"""
Retrieve a Component from the bots loaded Component.
This will return `None` if the Component was not found.
Parameters
----------
name: str
The name of the Component.
Returns
-------
Component | None
"""
return self._components.get(name)

def get_context(self, message: ChatMessage, *, cls: Any = None) -> Any:
cls = cls or Context
return cls(message, bot=self)
Expand Down

0 comments on commit 7f4b08f

Please sign in to comment.