From c289e1d323c4558541cc2e9f8b8c3cc4303df0dd Mon Sep 17 00:00:00 2001 From: AllfatherHatt Date: Sat, 15 Mar 2025 19:05:28 +0100 Subject: [PATCH] Turning to AI in desperation --- reginaldCog/memory.py | 8 ++------ reginaldCog/reginald.py | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/reginaldCog/memory.py b/reginaldCog/memory.py index d622f56..cb75e6f 100644 --- a/reginaldCog/memory.py +++ b/reginaldCog/memory.py @@ -11,15 +11,11 @@ from openai import OpenAIError class MemoryMixin: """Handles all memory-related functions for Reginald.""" - def __init__(self): - """No longer requires `config` as a parameter.""" + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # ✅ Ensure cooperative MRO initialization self.short_term_memory_limit = 100 self.summary_retention_limit = 25 self.summary_retention_ratio = 0.8 - - def get_config(self): - """Access `_config` from the parent class (ReginaldCog).""" - return self._config # ✅ Use `_config` instead of `self.config` @commands.command(name="reginald_clear_short", help="Clears short-term memory for this channel.") @commands.has_permissions(administrator=True) diff --git a/reginaldCog/reginald.py b/reginaldCog/reginald.py index 935037b..b3750b5 100644 --- a/reginaldCog/reginald.py +++ b/reginaldCog/reginald.py @@ -12,17 +12,17 @@ from .permissions import PermissionsMixin from .blacklist import BlacklistMixin from .memory import MemoryMixin -class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin): +class ReginaldCog(PermissionsMixin, BlacklistMixin, MemoryMixin, commands.Cog): def __init__(self, bot): self.bot = bot - self._config = Config.get_conf(self, identifier=71717171171717) # ✅ Store `_config` first + self.config = Config.get_conf(self, identifier=71717171171717) # ✅ Ensure config exists before super() - super().__init__() # Trying to get MemoryMixin to have access to _config + super().__init__() # ✅ Properly initialize all mixins & commands.Cog self.default_listening_channel = 1085649787388428370 self.memory_locks = {} - # Properly Registered Configuration Keys + # ✅ Properly Registered Configuration Keys default_global = {"openai_model": "gpt-4o-mini"} default_guild = { "openai_api_key": None,