34 lines
1 KiB
Python
Executable file
34 lines
1 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import print_function
|
|
import argparse
|
|
|
|
usage = """edit-message [options] --message-id=<msg_id> --subject=<new subject> --content=<new content>
|
|
|
|
Edits a message that you sent. At least one of --subject or --content must be
|
|
specified.
|
|
|
|
Example: edit-message --message-id="348135" --subject="my subject" --content="test message"
|
|
|
|
Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
|
|
"""
|
|
|
|
import zulip
|
|
|
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
|
parser.add_argument('--message-id', type=int, required=True)
|
|
parser.add_argument('--subject', default="")
|
|
parser.add_argument('--content', default="")
|
|
options = parser.parse_args()
|
|
|
|
client = zulip.init_from_options(options)
|
|
|
|
message_data = {
|
|
"message_id": options.message_id,
|
|
}
|
|
if options.subject != "":
|
|
message_data["subject"] = options.subject
|
|
if options.content != "":
|
|
message_data["content"] = options.content
|
|
print(client.update_message(message_data))
|