From c4df7c61060303f6ab5d193f38d78a5e4ee9bba2 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 11 Dec 2023 01:36:51 +0200 Subject: [PATCH 01/10] Update dependency ujson to ~=5.9.0 --- requirements/speed.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/speed.txt b/requirements/speed.txt index 37c6a01..934e0b8 100644 --- a/requirements/speed.txt +++ b/requirements/speed.txt @@ -1 +1 @@ -ujson~=5.8.0 \ No newline at end of file +ujson~=5.9.0 \ No newline at end of file -- 2.39.2 From 8e1f746309fe3b49d4aee3c2c1f8243d6b44bd09 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 11 Dec 2023 22:00:00 +0200 Subject: [PATCH 02/10] Update dependency isort to v5.13.1 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 644e136..a6fc4d5 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,6 +1,6 @@ black==23.11.0 build==1.0.3 -isort==5.13.0 +isort==5.13.1 mypy==1.7.1 pylint==3.0.2 pytest-asyncio==0.23.2 -- 2.39.2 From 45743bdb7e666e2f5b7dd05e495e7548aa4af73c Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 11 Dec 2023 23:04:59 +0200 Subject: [PATCH 03/10] Update dependency pylint to v3.0.3 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index a6fc4d5..dc8fe10 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -2,7 +2,7 @@ black==23.11.0 build==1.0.3 isort==5.13.1 mypy==1.7.1 -pylint==3.0.2 +pylint==3.0.3 pytest-asyncio==0.23.2 pytest-cov==4.1.0 pytest==7.4.3 -- 2.39.2 From f5f62f20cc9397cff1ae76eeb997a80ccff553f7 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 12 Dec 2023 04:27:38 +0200 Subject: [PATCH 04/10] Update dependency types-ujson to v5.9.0.0 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index dc8fe10..568e61e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -8,4 +8,4 @@ pytest-cov==4.1.0 pytest==7.4.3 tox==4.11.4 types-aiofiles==23.2.0.0 -types-ujson==5.8.0.1 \ No newline at end of file +types-ujson==5.9.0.0 \ No newline at end of file -- 2.39.2 From 88f77e84943f327ab5289bee7e781c0bde1f6859 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 12 Dec 2023 08:44:33 +0200 Subject: [PATCH 05/10] Update dependency black to v23.12.0 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 568e61e..d698fa3 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -black==23.11.0 +black==23.12.0 build==1.0.3 isort==5.13.1 mypy==1.7.1 -- 2.39.2 From 3d10cbcb2f4676adbadcbc1096c5878322d5212f Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 13 Dec 2023 23:11:44 +0200 Subject: [PATCH 06/10] Update dependency isort to v5.13.2 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index d698fa3..e337e46 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,6 +1,6 @@ black==23.12.0 build==1.0.3 -isort==5.13.1 +isort==5.13.2 mypy==1.7.1 pylint==3.0.3 pytest-asyncio==0.23.2 -- 2.39.2 From bfa3d4f6e919fe5f7e5b354c763471a44a5bb485 Mon Sep 17 00:00:00 2001 From: Renovate Date: Thu, 21 Dec 2023 19:03:19 +0200 Subject: [PATCH 07/10] Update dependency mypy to v1.8.0 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index e337e46..4089827 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,7 +1,7 @@ black==23.12.0 build==1.0.3 isort==5.13.2 -mypy==1.7.1 +mypy==1.8.0 pylint==3.0.3 pytest-asyncio==0.23.2 pytest-cov==4.1.0 -- 2.39.2 From 73c3a1ff1313f0bd848925133ed939cba1e098ad Mon Sep 17 00:00:00 2001 From: Renovate Date: Sat, 23 Dec 2023 01:39:45 +0200 Subject: [PATCH 08/10] Update dependency black to v23.12.1 --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 4089827..8e5ea9c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -black==23.12.0 +black==23.12.1 build==1.0.3 isort==5.13.2 mypy==1.8.0 -- 2.39.2 From 17f15aca5bd262195fa78366a1a2e60b9cda8910 Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 27 Dec 2023 13:45:40 +0100 Subject: [PATCH 09/10] Initial Pycord addition --- requirements/pycord.txt | 1 + requirements/pyrogram.txt | 2 +- src/libbot/__init__.py | 2 +- src/libbot/pycord/classes/__init__.py | 1 + src/libbot/pycord/classes/bot.py | 57 +++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/libbot/pycord/classes/__init__.py create mode 100644 src/libbot/pycord/classes/bot.py diff --git a/requirements/pycord.txt b/requirements/pycord.txt index e38caa7..5c3fd69 100644 --- a/requirements/pycord.txt +++ b/requirements/pycord.txt @@ -1 +1,2 @@ +apscheduler~=3.10.4 py-cord~=2.4.1 \ No newline at end of file diff --git a/requirements/pyrogram.txt b/requirements/pyrogram.txt index 9d72624..a7d1e59 100644 --- a/requirements/pyrogram.txt +++ b/requirements/pyrogram.txt @@ -1,2 +1,2 @@ -apscheduler~=3.10.1 +apscheduler~=3.10.4 pyrogram~=2.0.106 \ No newline at end of file diff --git a/src/libbot/__init__.py b/src/libbot/__init__.py index c26fb2f..163d106 100644 --- a/src/libbot/__init__.py +++ b/src/libbot/__init__.py @@ -2,5 +2,5 @@ __version__ = "2.0.1" __license__ = "GPL3" __author__ = "Profitroll" -from . import i18n, pyrogram, sync +from . import i18n, pycord, pyrogram, sync from .__main__ import * diff --git a/src/libbot/pycord/classes/__init__.py b/src/libbot/pycord/classes/__init__.py new file mode 100644 index 0000000..4294771 --- /dev/null +++ b/src/libbot/pycord/classes/__init__.py @@ -0,0 +1 @@ +from .bot import PycordBot diff --git a/src/libbot/pycord/classes/bot.py b/src/libbot/pycord/classes/bot.py new file mode 100644 index 0000000..e59dad5 --- /dev/null +++ b/src/libbot/pycord/classes/bot.py @@ -0,0 +1,57 @@ +import logging +from pathlib import Path +from typing import Any, Dict, Union + +try: + from apscheduler.schedulers.asyncio import AsyncIOScheduler + from apscheduler.schedulers.background import BackgroundScheduler + from discord import Bot +except ImportError as exc: + raise ImportError( + "You need to install libbot[pycord] in order to use this class." + ) from exc + +try: + from ujson import loads +except ImportError: + from json import loads + +from libbot.i18n import BotLocale +from libbot.i18n.sync import _ + +logger = logging.getLogger(__name__) + + +class PycordBot(Bot): + def __init__( + self, + config: Union[Dict[str, Any], None] = None, + config_path: Union[str, Path] = Path("config.json"), + locales_root: Union[str, Path, None] = None, + scheduler: Union[AsyncIOScheduler, BackgroundScheduler, None] = None, + **kwargs, + ): + if config is None: + with open(config_path, "r", encoding="utf-8") as f: + self.config: dict = loads(f.read()) + else: + self.config = config + + super().__init__( + debug_guilds=self.config["bot"]["debug_guilds"], + owner_ids=self.config["bot"]["owners"], + **kwargs, + ) + + self.bot_locale: BotLocale = BotLocale( + default_locale=self.config["locale"], + locales_root=(Path("locale") if locales_root is None else locales_root), + ) + self.default_locale: str = self.bot_locale.default + self.locales: dict = self.bot_locale.locales + + self._ = self.bot_locale._ + self.in_all_locales = self.bot_locale.in_all_locales + self.in_every_locale = self.bot_locale.in_every_locale + + self.scheduler: Union[AsyncIOScheduler, BackgroundScheduler, None] = scheduler -- 2.39.2 From e7555d3de1f9bc7600b5b8e5af369c50492ad1ee Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 27 Dec 2023 13:46:10 +0100 Subject: [PATCH 10/10] Bump version to 2.1.0 --- src/libbot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libbot/__init__.py b/src/libbot/__init__.py index 163d106..4f9160f 100644 --- a/src/libbot/__init__.py +++ b/src/libbot/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.0.1" +__version__ = "2.1.0" __license__ = "GPL3" __author__ = "Profitroll" -- 2.39.2