feat (tasklist): Migration to new profile tables.

This commit is contained in:
2024-11-30 15:48:15 +10:00
parent d4870740a2
commit 49a8cefeef
8 changed files with 166 additions and 51 deletions

View File

@@ -40,6 +40,17 @@ class ProfileCog(LionCog):
async def cog_check(self, ctx):
return True
async def bot_check_once(self, ctx: LionContext):
"""
Inject the contextual UserProfile and Community into the LionContext.
Creates the profile and community if they do not exist.
"""
if ctx.guild:
ctx.community = await self.fetch_community_discord(ctx.guild)
ctx.profile = await self.fetch_profile_discord(ctx.author)
return True
# Profile API
def add_profile_migrator(self, migrator, name=None):
name = name or migrator.__name__