development #1
@ -11,16 +11,12 @@ 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)
|
||||||
async def clear_short_memory(self, ctx):
|
async def clear_short_memory(self, ctx):
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user