mirror of https://github.com/zulip/zulip.git
bots: Import new copy of our Trac bot.
(imported from commit 17ce8162317f6e4f642ee4e9ee65413bbbdd9bbd)
This commit is contained in:
parent
209a1bee3b
commit
f57caf08d1
|
@ -36,18 +36,24 @@
|
||||||
# (or changes to the bot) to actually be loaded by trac.
|
# (or changes to the bot) to actually be loaded by trac.
|
||||||
|
|
||||||
# Change these constants:
|
# Change these constants:
|
||||||
HUMBUG_API_PATH = "/home/humbug/humbug/api"
|
|
||||||
HUMBUG_SITE = "https://staging.humbughq.com"
|
|
||||||
HUMBUG_USER = "humbug+trac@humbughq.com"
|
HUMBUG_USER = "humbug+trac@humbughq.com"
|
||||||
HUMBUG_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
HUMBUG_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
STREAM_FOR_NOTIFICATIONS = "trac"
|
||||||
TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket"
|
TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket"
|
||||||
|
|
||||||
|
# This should not need to change unless you have a custom Humbug subdomain.
|
||||||
|
HUMBUG_SITE = "https://staging.humbughq.com"
|
||||||
|
## If properly installed, the Humbug API should be in your import
|
||||||
|
## path, but if not, set a custom path below
|
||||||
|
HUMBUG_API_PATH = "/home/humbug/humbug/api"
|
||||||
|
|
||||||
from trac.core import Component, implements
|
from trac.core import Component, implements
|
||||||
from trac.ticket import ITicketChangeListener
|
from trac.ticket import ITicketChangeListener
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(HUMBUG_API_PATH)
|
if HUMBUG_API_PATH is not None:
|
||||||
|
sys.path.append(HUMBUG_API_PATH)
|
||||||
|
|
||||||
import humbug
|
import humbug
|
||||||
client = humbug.Client(
|
client = humbug.Client(
|
||||||
email=HUMBUG_USER,
|
email=HUMBUG_USER,
|
||||||
|
@ -71,7 +77,7 @@ def trac_subject(ticket):
|
||||||
def send_update(ticket, content):
|
def send_update(ticket, content):
|
||||||
client.send_message({
|
client.send_message({
|
||||||
"type": "stream",
|
"type": "stream",
|
||||||
"to": "trac",
|
"to": STREAM_FOR_NOTIFICATIONS,
|
||||||
"content": content,
|
"content": content,
|
||||||
"subject": trac_subject(ticket)
|
"subject": trac_subject(ticket)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue