aboutsummaryrefslogtreecommitdiffstats
path: root/botcore
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-04-18 22:38:49 +0100
committerGravatar Chris Lovering <[email protected]>2022-04-18 23:09:30 +0100
commit8cff0d143fa64fd947ee9607745c32a6a96a7312 (patch)
tree0b9639d5c00e1a2be910560885266c71860e5461 /botcore
parentMerge pull request #61 from python-discord/redis-reconnect-on-setup (diff)
Allow passing an api_client kwarg to BotBase
Diffstat (limited to 'botcore')
-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