feat(dreams): Add basic document viewer.
This commit is contained in:
@@ -9,6 +9,7 @@ from meta.logger import log_wrap
|
||||
from utils.lib import utc_now
|
||||
|
||||
from . import logger
|
||||
from .ui.docviewer import DocumentViewer
|
||||
|
||||
|
||||
class DreamCog(LionCog):
|
||||
@@ -46,8 +47,24 @@ class DreamCog(LionCog):
|
||||
# (Admin): View events/documents matching certain criteria
|
||||
|
||||
# (User): View own event cards with info?
|
||||
# Let's make a demo viewer which lists their event cards and let's them open one via select?
|
||||
# /documents -> Show a paged list of documents, select option displays the document in a viewer
|
||||
@cmds.hybrid_command(
|
||||
name='documents',
|
||||
description="View your printer log!"
|
||||
)
|
||||
async def documents_cmd(self, ctx: LionContext):
|
||||
profile = await self.bot.get_cog('ProfileCog').fetch_profile_discord(ctx.author)
|
||||
events = await self.data.Events.fetch_where(user_id=profile.profileid)
|
||||
docids = [event.document_id for event in events if event.document_id is not None]
|
||||
if not docids:
|
||||
await ctx.error_reply("You don't have any documents yet!")
|
||||
return
|
||||
|
||||
# (User): View Specimen
|
||||
view = DocumentViewer(self.bot, ctx.interaction.user.id, filter=(self.data.Document.document_id == docids))
|
||||
await view.run(ctx.interaction)
|
||||
|
||||
# (User): View Specimen information
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user