(tasklist): Pass context to factory.
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user