26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 ''' |
27 ''' |
28 |
28 |
29 from __future__ import print_function |
29 from __future__ import print_function |
30 import bt |
30 import bt |
|
31 import modulecore |
31 |
32 |
32 ModuleData = { |
33 @modulecore.irc_command (args='<ticket>') |
33 'commands': |
34 def ticket (bot, args, replyto, **rest): |
34 [ |
35 '''Gets information about a MantisBT ticket.''' |
35 { |
|
36 'name': 'ticket', |
|
37 'description': 'Gets ticket info', |
|
38 'args': '<ticket>', |
|
39 'level': 'normal', |
|
40 }, |
|
41 |
|
42 { |
|
43 'name': 'testannounce', |
|
44 'description': 'Tests the ticket announcer', |
|
45 'args': '<ticket>', |
|
46 'level': 'admin', |
|
47 }, |
|
48 |
|
49 { |
|
50 'name': 'checkbt', |
|
51 'description': 'Polls the bug tracker for new tickets', |
|
52 'args': None, |
|
53 'level': 'admin', |
|
54 }, |
|
55 |
|
56 { |
|
57 'name': 'btsoap', |
|
58 'description': 'Sends a custom SOAP query', |
|
59 'args': '<func> [args...]', |
|
60 'level': 'admin', |
|
61 }, |
|
62 ] |
|
63 } |
|
64 |
|
65 def cmd_ticket (bot, args, replyto, **rest): |
|
66 bt.get_ticket_data (bot, replyto, args['ticket'], True) |
36 bt.get_ticket_data (bot, replyto, args['ticket'], True) |
67 |
37 |
68 def cmd_testannounce (bot, args, **rest): |
38 @modulecore.irc_command (args='<ticket>', level='admin') |
|
39 def testannounce (bot, args, **rest): |
|
40 '''Tests the ticket announcer.''' |
69 bt.announce_new_issue (bot, bt.get_issue (args['ticket'])) |
41 bt.announce_new_issue (bot, bt.get_issue (args['ticket'])) |
70 |
42 |
71 def cmd_checkbt (bot, **rest): |
43 @modulecore.irc_command (level='admin') |
|
44 def checkbt (bot, **rest): |
|
45 '''Polls the bug tracker for new tickets.''' |
72 bt.poll() |
46 bt.poll() |
73 |
47 |
74 def cmd_btsoap (bot, args, reply, **rest): |
48 @modulecore.irc_command (args='<func> [args...]', level='admin') |
|
49 def btsoap (bot, args, reply, **rest): |
|
50 '''Sends a custom SOAP query''' |
75 result = bt.custom_query (args['func'], args['args'].split (' ') if 'args' in args else []) |
51 result = bt.custom_query (args['func'], args['args'].split (' ') if 'args' in args else []) |
76 |
52 |
77 for line in result.splitlines(): |
53 for line in result.splitlines(): |
78 reply (line) |
54 reply (line) |