Skeleton module structure.
This commit is contained in:
8
src/modules/dreamspace/__init__.py
Normal file
8
src/modules/dreamspace/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
async def setup(bot):
|
||||||
|
from .cog import DreamCog
|
||||||
|
await bot.add_cog(DreamCog(bot))
|
||||||
53
src/modules/dreamspace/cog.py
Normal file
53
src/modules/dreamspace/cog.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
import discord
|
||||||
|
from discord import app_commands as appcmds
|
||||||
|
from discord.ext import commands as cmds
|
||||||
|
|
||||||
|
from meta import LionCog, LionBot, LionContext
|
||||||
|
from meta.logger import log_wrap
|
||||||
|
from utils.lib import utc_now
|
||||||
|
|
||||||
|
from . import logger
|
||||||
|
|
||||||
|
|
||||||
|
class DreamCog(LionCog):
|
||||||
|
"""
|
||||||
|
Discord-facting interface for Dreamspace Adventures
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, bot: LionBot):
|
||||||
|
self.bot = bot
|
||||||
|
self.data = bot.core.datamodel
|
||||||
|
|
||||||
|
async def cog_load(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@log_wrap(action="Dreamer migration")
|
||||||
|
async def migrate_dreamer(self, source_profile, target_profile):
|
||||||
|
"""
|
||||||
|
Called when two dreamer profiles need to merge.
|
||||||
|
|
||||||
|
For example, when a user links a second twitch profile.
|
||||||
|
|
||||||
|
:TODO-MARKER:
|
||||||
|
Most of the migration logic is simple, e.g. just update the profileid
|
||||||
|
on the old events to the new profile.
|
||||||
|
The same applies to transactions and probably to inventory items.
|
||||||
|
However, there are some subtle choices to make, such as what to do
|
||||||
|
if both the old and the new profile have an active specimen?
|
||||||
|
A profile can only have one active specimen at a time.
|
||||||
|
There is also the question of how to merge user preferences, when those exist.
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
|
# User command: view their dreamer card, wallet inventory etc
|
||||||
|
|
||||||
|
# (Admin): View events/documents matching certain criteria
|
||||||
|
|
||||||
|
# (User): View own event cards with info?
|
||||||
|
|
||||||
|
# (User): View Specimen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
36
src/modules/dreamspace/events.py
Normal file
36
src/modules/dreamspace/events.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
from datamodels import DataModel
|
||||||
|
|
||||||
|
|
||||||
|
class Event:
|
||||||
|
_typs = {}
|
||||||
|
|
||||||
|
def __init__(self, event_row: DataModel.Events, **kwargs):
|
||||||
|
self.row = event_row
|
||||||
|
|
||||||
|
def __getattribute__(self, name: str):
|
||||||
|
...
|
||||||
|
|
||||||
|
async def get_document(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
async def get_user(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class Document:
|
||||||
|
def as_bytes(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
async def get_stamps(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
async def refresh(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class User:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class Stamp:
|
||||||
|
...
|
||||||
0
src/modules/dreamspace/ui/eventviewer.py
Normal file
0
src/modules/dreamspace/ui/eventviewer.py
Normal file
Reference in New Issue
Block a user