File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,33 @@ def __init__(
166166
167167 self .__waiter : asyncio .Event = asyncio .Event ()
168168
169+ @property
170+ def adapter (self ) -> BaseAdapter :
171+ """Property returning the :class:`~twitchio.AiohttpAdapter` or :class:`~twitchio.StarlettepAdapter` the bot is
172+ currently running."""
173+ return self ._adapter
174+
175+ async def set_adapter (self , adapter : BaseAdapter ) -> None :
176+ """|async|
177+
178+ Method which sets and starts a new web adapter which inherits from either :class:`~twitchio.AiohttpAdapter` or
179+ :class:`~twitchio.StarlettepAdapter` or implements the :class:`~twitchio.BaseAdapter` specifications.
180+
181+ Parameters
182+ ----------
183+ adapter: :class:`~twitchio.BaseAdapter`
184+ The new adapter to assign and start.
185+
186+ Returns
187+ -------
188+ None
189+ """
190+ if self ._adapter :
191+ await self ._adapter .close ()
192+
193+ self ._adapter = adapter
194+ await self ._adapter .run ()
195+
169196 @property
170197 def tokens (self ) -> MappingProxyType [str , TokenMappingData ]:
171198 """Property which returns a read-only mapping of the tokens that are managed by the `Client`.
You can’t perform that action at this time.
0 commit comments