From 714a2f6706373f087aa0680e2ff21bd2d4b4da43 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Tue, 13 Aug 2019 10:42:26 +0200 Subject: [PATCH] Add comment command --- jan-pona-mute.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jan-pona-mute.py b/jan-pona-mute.py index 25ad73d..744eb42 100755 --- a/jan-pona-mute.py +++ b/jan-pona-mute.py @@ -72,6 +72,8 @@ class DiasporaClient(cmd.Cmd): notifications = [] index = None post = None + undo = [] + # dict mapping user ids to usernames users = {} @@ -292,6 +294,16 @@ The index number must refer to the current list of notifications.""" print() self.show(comment) + def do_comment(self, line): + """Leave a comment on the current post.""" + if self.post == None: + print("Use the show command to show a post, first.") + return + comment = self.post.comment(line) + self.post.comments.add(comment) + self.undo.append("delete comment %s from %s" % (comment.id, self.post.guid)) + print("Comment posted.") + # Main function def main(): -- 2.25.1