Bots: Send messages through staging.humbughq.com.
(imported from commit d9859bfe5f5b3b7c5efa5ef930d6cfaa5c0d1fc2)
This commit is contained in:
parent
66640aefc6
commit
db0a064c80
|
@ -3,25 +3,16 @@ import sys
|
||||||
import os
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
usage = """feedback-bot [options]
|
|
||||||
|
|
||||||
Forwards messages from MIT realm users sent to feedback@humbughq.com over to Humbug realm
|
|
||||||
|
|
||||||
Example: feedback-bot --site=http://127.0.0.1:9991
|
|
||||||
"""
|
|
||||||
parser = optparse.OptionParser(usage=usage)
|
|
||||||
parser.add_option('--site',
|
|
||||||
dest='site',
|
|
||||||
default="https://humbughq.com",
|
|
||||||
action='store')
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||||
import api.common
|
import api.common
|
||||||
client = api.common.HumbugAPI(email="feedback@humbughq.com",
|
prod_client = api.common.HumbugAPI(email="feedback@humbughq.com",
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
verbose=True,
|
verbose=True,
|
||||||
site=options.site)
|
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):
|
def forward_message(message):
|
||||||
forwarded_message = {
|
forwarded_message = {
|
||||||
|
@ -30,6 +21,6 @@ def forward_message(message):
|
||||||
"subject": "feedback from %s" % message["sender_email"],
|
"subject": "feedback from %s" % message["sender_email"],
|
||||||
"content": message["content"],
|
"content": message["content"],
|
||||||
}
|
}
|
||||||
client.send_message(forwarded_message)
|
staging_client.send_message(forwarded_message)
|
||||||
|
|
||||||
client.call_on_each_message(forward_message)
|
prod_client.call_on_each_message(forward_message)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import sys
|
||||||
sys.path.append("/home/humbug/humbug")
|
sys.path.append("/home/humbug/humbug")
|
||||||
import api.common
|
import api.common
|
||||||
client = api.common.HumbugAPI(email="humbug+trac@humbughq.com",
|
client = api.common.HumbugAPI(email="humbug+trac@humbughq.com",
|
||||||
|
site="https://staging.humbughq.com",
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
||||||
|
|
||||||
def markdown_ticket_url(ticket, heading="ticket"):
|
def markdown_ticket_url(ticket, heading="ticket"):
|
||||||
|
|
Loading…
Reference in a new issue