17 'level': 'admin', |
17 'level': 'admin', |
18 }, |
18 }, |
19 ] |
19 ] |
20 } |
20 } |
21 |
21 |
22 def get_ticket_data (bot, replyto, ticket, withlink): |
22 def cmd_ticket (bot, args, replyto, **rest): |
23 if suds_active == False: |
|
24 return |
|
25 |
|
26 data = {} |
|
27 try: |
|
28 data = bt_getissue (ticket) |
|
29 except Exception, e: |
|
30 bot.privmsg (replyto, "Failed to get info for issue %s: %s" % (ticket, `e`)) |
|
31 |
|
32 if data: |
|
33 if data['view_state']['name'] == 'private': |
|
34 allowprivate = False |
|
35 |
|
36 for channel in bot.channels: |
|
37 if channel.get_value ('name') == replyto and channel.get_value ('btprivate', False): |
|
38 allowprivate = True |
|
39 break |
|
40 #fi |
|
41 #done |
|
42 |
|
43 if not allowprivate: |
|
44 bot.privmsg (replyto, 'Error: ticket %s is private' % ticket) |
|
45 return |
|
46 #fi |
|
47 #fi |
|
48 |
|
49 bot.privmsg (replyto, "Issue %s: %s: Reporter: %s, assigned to: %s, status: %s (%s)" % \ |
|
50 (ticket, \ |
|
51 data.summary, \ |
|
52 data.reporter.name if hasattr (data.reporter, 'name') else "<unknown>", \ |
|
53 data.handler.name if hasattr (data, 'handler') else "nobody", \ |
|
54 data.status.name, \ |
|
55 data.resolution.name)) |
|
56 |
|
57 if withlink: |
|
58 bot.privmsg (replyto, "Read all about it here: " + bot.get_ticket_url (ticket)) |
|
59 #fi |
|
60 #fi |
|
61 #enddef |
|
62 |
|
63 def cmd_ticket (bot, args, **rest): |
|
64 Bt.get_ticket_data (bot, replyto, args['ticket'], True) |
23 Bt.get_ticket_data (bot, replyto, args['ticket'], True) |
65 |
24 |
66 def cmd_testannounce (bot, args, **rest); |
25 def cmd_testannounce (bot, args, **rest): |
67 elif command == 'testannounce': |
26 Bt.announce_new_issue (bot, Bt.get_issue (args['ticket'])) |
68 check_admin (sender, ident, host, command) |
|
69 if len(args) != 1: |
|
70 raise logical_exception ("usage: .%s <ticket>" % command) |
|
71 self.announce_ticket (bt_getissue (args[0])) |
|