python-zulip-api/bots/feedback-bot
Tim Abbott 6727e9dbd9 [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00

29 lines
1 KiB
Python
Executable file

#!/usr/bin/python
import sys
import os
import optparse
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import api.common
prod_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://humbughq.com")
staging_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://staging.humbughq.com")
def forward_message(message):
if message["type"] != "personal":
return
forwarded_message = {
"type": "stream",
"to": "support",
"subject": "feedback from %s" % message["sender_email"],
"content": message["content"],
}
staging_client.send_message(forwarded_message)
prod_client.call_on_each_message(forward_message)