aboutsummaryrefslogtreecommitdiffstats
path: root/botcore/_bot.py
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2022-04-19 10:30:14 +0100
committerGravatar GitHub <[email protected]>2022-04-19 10:30:14 +0100
commitc41598efa298a2bb2e1c37f893b51de39783757b (patch)
tree0b9639d5c00e1a2be910560885266c71860e5461 /botcore/_bot.py
parentMerge pull request #61 from python-discord/redis-reconnect-on-setup (diff)
parentAllow passing an api_client kwarg to BotBase (diff)
Merge pull request #63 from python-discord/BotBase-api_client-kwargv5.0.4
Allow passing an api_client kwarg to BotBase
Diffstat (limited to 'botcore/_bot.py')
-rw-r--r--botcore/_bot.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/botcore/_bot.py b/botcore/_bot.py
index 69ccdc1c..90de58a5 100644
--- a/botcore/_bot.py
+++ b/botcore/_bot.py
@@ -40,6 +40,7 @@ class BotBase(commands.Bot):
allowed_roles: list,
http_session: aiohttp.ClientSession,
redis_session: Optional[RedisSession] = None,
+ api_client: Optional[APIClient] = None,
**kwargs,
):
"""
@@ -49,9 +50,10 @@ class BotBase(commands.Bot):
guild_id: The ID of the guild use for :func:`wait_until_guild_available`.
allowed_roles: A list of role IDs that the bot is allowed to mention.
http_session (aiohttp.ClientSession): The session to use for the bot.
- redis_session: The
- ``[async_rediscache.RedisSession](https://github.com/SebastiaanZ/async-rediscache#creating-a-redissession)``
- to use for the bot.
+ redis_session: The `async_rediscache.RedisSession`_ to use for the bot.
+ api_client: The :obj:`botcore.site_api.APIClient` instance to use for the bot.
+
+ .. _async_rediscache.RedisSession: https://github.com/SebastiaanZ/async-rediscache#creating-a-redissession
"""
super().__init__(
*args,
@@ -61,14 +63,13 @@ class BotBase(commands.Bot):
self.guild_id = guild_id
self.http_session = http_session
+ self.api_client = api_client
if redis_session and RedisSession == discord.utils._MissingSentinel:
warnings.warn("redis_session kwarg passed, but async-rediscache not installed!")
elif redis_session:
self.redis_session = redis_session
- self.api_client: Optional[APIClient] = None
-
self._resolver: Optional[aiohttp.AsyncResolver] = None
self._connector: Optional[aiohttp.TCPConnector] = None