From b0e11fef56cdf132664933e10ec232492d0497b6 Mon Sep 17 00:00:00 2001 From: Conatum Date: Thu, 11 Jul 2024 15:35:45 +1000 Subject: [PATCH] Minor bugfixes and adjustment for new dpy. --- src/core/cog.py | 1 - src/data/connector.py | 4 ++-- src/meta/LionBot.py | 2 +- src/meta/LionTree.py | 2 +- src/modules/shop/cog.py | 5 +++-- src/modules/sponsors/cog.py | 2 +- src/modules/sysadmin/presence.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/cog.py b/src/core/cog.py index dde79881..fc3b5bb8 100644 --- a/src/core/cog.py +++ b/src/core/cog.py @@ -118,7 +118,6 @@ class CoreCog(LionCog): await self.bot.remove_cog(self.lions.qualified_name) self.bot.remove_listener(self.shard_update_guilds, name='on_guild_join') self.bot.remove_listener(self.shard_update_guilds, name='on_guild_leave') - self.bot.core = None @LionCog.listener('on_ready') @log_wrap(action='Touch shard data') diff --git a/src/data/connector.py b/src/data/connector.py index 7b25aed3..6baf3b55 100644 --- a/src/data/connector.py +++ b/src/data/connector.py @@ -47,8 +47,8 @@ class Connector: return AsyncConnectionPool( self._conn_args, open=False, - min_size=4, - max_size=8, + min_size=1, + max_size=4, configure=self._setup_connection, kwargs=self._conn_kwargs ) diff --git a/src/meta/LionBot.py b/src/meta/LionBot.py index 4b32df48..79979cb7 100644 --- a/src/meta/LionBot.py +++ b/src/meta/LionBot.py @@ -320,7 +320,7 @@ class LionBot(Bot): # TODO: Some of these could have more user-feedback logger.debug(f"Handling command error for {ctx}: {exception}") if isinstance(ctx.command, HybridCommand) and ctx.command.app_command: - cmd_str = ctx.command.app_command.to_dict() + cmd_str = ctx.command.app_command.to_dict(self.tree) else: cmd_str = str(ctx.command) try: diff --git a/src/meta/LionTree.py b/src/meta/LionTree.py index cecf3b6c..ab70eb44 100644 --- a/src/meta/LionTree.py +++ b/src/meta/LionTree.py @@ -152,7 +152,7 @@ class LionTree(CommandTree): return set_logging_context(action=f"Run {command.qualified_name}") - logger.debug(f"Running command '{command.qualified_name}': {command.to_dict()}") + logger.debug(f"Running command '{command.qualified_name}': {command!r}") try: await command._invoke_with_namespace(interaction, namespace) except AppCommandError as e: diff --git a/src/modules/shop/cog.py b/src/modules/shop/cog.py index a6885751..5917055f 100644 --- a/src/modules/shop/cog.py +++ b/src/modules/shop/cog.py @@ -101,8 +101,9 @@ class Shopping(LionCog): self.active_cogs.append(shop_cog) async def cog_unload(self): - for shop in self.shops: - await shop.unload() + # for shop in self.shops: + # await shop.unload() + pass @cmds.hybrid_group( name=_p('group:editshop', 'editshop') diff --git a/src/modules/sponsors/cog.py b/src/modules/sponsors/cog.py index 267c7d63..b290c7da 100644 --- a/src/modules/sponsors/cog.py +++ b/src/modules/sponsors/cog.py @@ -20,7 +20,7 @@ class SponsorCog(LionCog): def __init__(self, bot: LionBot): self.bot = bot self.data: SponsorData = bot.db.load_registry(SponsorData()) - self.settings = SponsorSettings + self.settings = SponsorSettings() self.whitelisted = self.settings.Whitelist._cache diff --git a/src/modules/sysadmin/presence.py b/src/modules/sysadmin/presence.py index 3d746f80..a9ceb36e 100644 --- a/src/modules/sysadmin/presence.py +++ b/src/modules/sysadmin/presence.py @@ -284,7 +284,7 @@ class PresenceCtrl(LionCog): async def reload_presence(self) -> None: # Reload the presence information from the appconfig table # TODO: When botconfig is done, these should load from settings, instead of directly from data - self.data.AppPresence._cache_.pop(appname, None) + self.data.AppPresence._cache_.pop((appname,), None) self.activity_type = (await self.settings.PresenceType.get(appname)).value.value[2] self.activity_format = (await self.settings.PresenceName.get(appname)).value self.status = (await self.settings.PresenceStatus.get(appname)).value.value[2]