Add comment command
authorAlex Schroeder <alex@gnu.org>
Tue, 13 Aug 2019 08:42:26 +0000 (10:42 +0200)
committerAlex Schroeder <alex@gnu.org>
Tue, 13 Aug 2019 08:42:26 +0000 (10:42 +0200)
jan-pona-mute.py

index 25ad73d4a5ff6019ea44d0463793df0cd49b8c33..744eb429999b3ab4dc4948990ca6e79c31432de8 100755 (executable)
@@ -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():