development #1

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

View File

@ -11,15 +11,11 @@ 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): def __init__(self, *args, **kwargs):
"""No longer requires `config` as a parameter.""" super().__init__(*args, **kwargs) # ✅ Ensure cooperative MRO initialization
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

@ -12,17 +12,17 @@ from .permissions import PermissionsMixin
from .blacklist import BlacklistMixin from .blacklist import BlacklistMixin
from .memory import MemoryMixin from .memory import MemoryMixin
class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin): class ReginaldCog(PermissionsMixin, BlacklistMixin, MemoryMixin, commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = 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.default_listening_channel = 1085649787388428370
self.memory_locks = {} self.memory_locks = {}
# Properly Registered Configuration Keys # Properly Registered Configuration Keys
default_global = {"openai_model": "gpt-4o-mini"} default_global = {"openai_model": "gpt-4o-mini"}
default_guild = { default_guild = {
"openai_api_key": None, "openai_api_key": None,