diff --git a/boticordpy/__init__.py b/boticordpy/__init__.py index 6f54058..af7cc30 100644 --- a/boticordpy/__init__.py +++ b/boticordpy/__init__.py @@ -10,7 +10,7 @@ __title__ = "boticordpy" __author__ = "Marakarka" __license__ = "MIT" __copyright__ = "Copyright 2022 Marakarka" -__version__ = "2.2.0" +__version__ = "2.2.1" from .client import BoticordClient from .webhook import Webhook diff --git a/boticordpy/client.py b/boticordpy/client.py index e8c5ca0..5c48461 100644 --- a/boticordpy/client.py +++ b/boticordpy/client.py @@ -8,22 +8,29 @@ from .autopost import AutoPost class BoticordClient: """Represents a client that can be used to interact with the BotiCord API. + .. warning:: + + In BotiCord API v2 there are some changes with token. + [Read more here](https://docs.boticord.top/topics/v1vsv2/) + Note: Remember that every http method can return http exception. Args: token (:obj:`str`) Your bot's Boticord API Token. + version (:obj:`int`) + BotiCord API version """ __slots__ = ("http", "_autopost", "_token") http: HttpClient - def __init__(self, token=None): + def __init__(self, token: str = None, version: int = 1): self._token = token self._autopost: typing.Optional[AutoPost] = None - self.http = HttpClient(token) + self.http = HttpClient(token, version) async def get_bot_info(self, bot_id: int) -> boticord_types.Bot: """Gets information about specified bot. diff --git a/boticordpy/http.py b/boticordpy/http.py index 515fc27..7124a86 100644 --- a/boticordpy/http.py +++ b/boticordpy/http.py @@ -20,9 +20,9 @@ class HttpClient: loop: `asyncio loop` """ - def __init__(self, auth_token, **kwargs): + def __init__(self, auth_token: str, version: int = 1, **kwargs): self.token = auth_token - self.API_URL = "https://api.boticord.top/v1/" + self.API_URL = f"https://api.boticord.top/v{version}/" loop = kwargs.get("loop") or asyncio.get_event_loop()