Add event ID parameter to karma up/down commands

This commit is contained in:
Tulir Asokan 2019-09-29 01:11:30 +03:00
parent 959dabeda0
commit 6ddd2333a0

View file

@ -69,13 +69,15 @@ class KarmaBot(Plugin):
async def karma(self) -> None: async def karma(self) -> None:
pass pass
@karma.subcommand("up", help="Upvote a message") @karma.subcommand("up", help="Upvote an event")
def upvote(self, evt: MessageEvent) -> Awaitable[None]: @command.argument("event_id", "Event ID", required=True)
return self._vote(evt, evt.content.get_reply_to(), +1) def upvote(self, evt: MessageEvent, event_id: EventID) -> Awaitable[None]:
return self._vote(evt, event_id, +1)
@karma.subcommand("down", help="Downvote a message") @karma.subcommand("down", help="Downvote a message")
def downvote(self, evt: MessageEvent) -> Awaitable[None]: @command.argument("event_id", "Event ID", required=True)
return self._vote(evt, evt.content.get_reply_to(), -1) def downvote(self, evt: MessageEvent, event_id: EventID) -> Awaitable[None]:
return self._vote(evt, event_id, -1)
@command.passive(UPVOTE) @command.passive(UPVOTE)
def upvote(self, evt: MessageEvent, _: Tuple[str]) -> Awaitable[None]: def upvote(self, evt: MessageEvent, _: Tuple[str]) -> Awaitable[None]: