(tasklist): Pass context to factory.

This commit is contained in:
2022-05-11 22:04:43 +03:00
parent adbeeaa523
commit 3fbc3b1fcb
2 changed files with 3 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ class Tasklist:
self.active[(member.id, channel.id)] = self self.active[(member.id, channel.id)] = self
@classmethod @classmethod
def fetch_or_create(cls, member, channel): def fetch_or_create(cls, ctx, flags, member, channel):
tasklist = cls.active.get((member.id, channel.id), None) tasklist = cls.active.get((member.id, channel.id), None)
return tasklist if tasklist is not None else cls(member, channel) return tasklist if tasklist is not None else cls(member, channel)

View File

@@ -11,7 +11,7 @@ from .Tasklist import Tasklist
name="todo", name="todo",
desc="Display and edit your personal To-Do list.", desc="Display and edit your personal To-Do list.",
group="Productivity", group="Productivity",
flags=('add==', 'delete==', 'check==', 'uncheck==', 'edit==') flags=('add==', 'delete==', 'check==', 'uncheck==', 'edit==', 'text')
) )
@in_guild() @in_guild()
async def cmd_todo(ctx, flags): async def cmd_todo(ctx, flags):
@@ -69,7 +69,7 @@ async def cmd_todo(ctx, flags):
return return
# TODO: Custom module, with pre-command hooks # TODO: Custom module, with pre-command hooks
tasklist = Tasklist.fetch_or_create(ctx.author, ctx.ch) tasklist = Tasklist.fetch_or_create(ctx, flags, ctx.author, ctx.ch)
keys = { keys = {
'add': (('add', ), tasklist.parse_add), 'add': (('add', ), tasklist.parse_add),