Screw properties, direct injection baby!
This commit is contained in:
parent
cdb5d20fa9
commit
3bf7d221a0
@ -11,12 +11,8 @@ from openai import OpenAIError
|
|||||||
class MemoryMixin:
|
class MemoryMixin:
|
||||||
"""Handles all memory-related functions for Reginald."""
|
"""Handles all memory-related functions for Reginald."""
|
||||||
|
|
||||||
@property
|
def __init__(self, config: Config):
|
||||||
def config(self):
|
self.config = config # Now explicitly set
|
||||||
"""Dynamically fetches the config from the parent cog."""
|
|
||||||
return self._config # This assumes `ReginaldCog` sets `self._config`
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
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
|
||||||
|
|||||||
@ -17,14 +17,7 @@ class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin):
|
|||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Config.get_conf(self, identifier=71717171171717)
|
self.config = Config.get_conf(self, identifier=71717171171717)
|
||||||
|
|
||||||
self._config = self.config # ✅ Ensure MemoryMixin sees this before calling super
|
# Properly Registered Configuration Keys
|
||||||
|
|
||||||
super().__init__() # ✅ Now it's safe to initialize parent classes
|
|
||||||
|
|
||||||
self.default_listening_channel = 1085649787388428370
|
|
||||||
self.memory_locks = {}
|
|
||||||
|
|
||||||
# ✅ 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,
|
||||||
@ -39,6 +32,9 @@ class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin):
|
|||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
self.config.register_guild(**default_guild)
|
self.config.register_guild(**default_guild)
|
||||||
|
|
||||||
|
# Pass config explicitly to MemoryMixin
|
||||||
|
MemoryMixin.__init__(self, self.config)
|
||||||
|
|
||||||
async def is_admin(self, ctx):
|
async def is_admin(self, ctx):
|
||||||
admin_role_id = await self.config.guild(ctx.guild).admin_role()
|
admin_role_id = await self.config.guild(ctx.guild).admin_role()
|
||||||
if admin_role_id:
|
if admin_role_id:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user