development #1

Merged
AllfatherHatt merged 157 commits from development into master 2025-06-14 15:47:26 +02:00
2 changed files with 8 additions and 9 deletions
Showing only changes of commit b8cea3f961 - Show all commits

View File

@ -11,11 +11,15 @@ from openai import OpenAIError
class MemoryMixin: class MemoryMixin:
"""Handles all memory-related functions for Reginald.""" """Handles all memory-related functions for Reginald."""
def __init__(self, config: Config): def __init__(self):
self.config = config # Now explicitly set """No longer requires `config` as a parameter."""
self.short_term_memory_limit = 100 self.short_term_memory_limit = 100
self.summary_retention_limit = 25 self.summary_retention_limit = 25
self.summary_retention_ratio = 0.8 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.command(name="reginald_clear_short", help="Clears short-term memory for this channel.")
@commands.has_permissions(administrator=True) @commands.has_permissions(administrator=True)

View File

@ -15,14 +15,9 @@ from .memory import MemoryMixin
class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin): class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
config_instance = Config.get_conf(self, identifier=71717171171717) # ✅ Create config instance self._config = Config.get_conf(self, identifier=71717171171717) # ✅ Store `_config` first
# ✅ Pass config explicitly to MemoryMixin super().__init__() # Trying to get MemoryMixin to have access to _config
MemoryMixin.__init__(self, config_instance)
super().__init__() # ✅ Now it's safe to initialize parent classes
self.config = config_instance # ✅ Store config after parent init
self.default_listening_channel = 1085649787388428370 self.default_listening_channel = 1085649787388428370
self.memory_locks = {} self.memory_locks = {}