python-zulip-api/bots/feedback-bot
Zev Benjamin b945113867 [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00

32 lines
894 B
Python
Executable file

#!/usr/bin/python
import sys
import os
import optparse
from os import path
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
prod_client = humbug.Client(
email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://humbughq.com")
staging_client = humbug.Client(
email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://staging.humbughq.com")
def forward_message(message):
if message["type"] != "private" or len(message["recipient"]) != 2:
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)