From: Alex Schroeder Date: Tue, 13 Aug 2019 08:42:26 +0000 (+0200) Subject: Add comment command X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=714a2f6706373f087aa0680e2ff21bd2d4b4da43;p=jan-pona-mute.git Add comment command --- 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():