Skip to content

Commit

Permalink
Add get_context method (No docs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eviee Py committed Nov 5, 2024
1 parent 3b1281c commit f3d84e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion twitchio/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ async def remove_component(self, name: str, /) -> Component | None:

return component

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

async def _process_commands(self, message: ChatMessage) -> None:
ctx: Context = Context(message, bot=self)
ctx: Context = self.get_context(message)
await self.invoke(ctx)

async def process_commands(self, message: ChatMessage) -> None:
Expand Down

0 comments on commit f3d84e8

Please sign in to comment.