Come on, read config you stupid memory!
This commit is contained in:
parent
728ce2aee4
commit
b8cea3f961
@ -11,12 +11,16 @@ 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)
|
||||||
async def clear_short_memory(self, ctx):
|
async def clear_short_memory(self, ctx):
|
||||||
|
|||||||
@ -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 = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user