Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 69 lines (54 sloc) 2.01 kb
a34ce66 @alloy Add a !help banner.
alloy authored
1 # encoding: UTF-8
ba41b5e @alloy Before listing assigned/marked tickets, give a summary.
alloy authored
2
41d5b48 @alloy Initial commit/
alloy authored
3 $:.unshift File.expand_path("../../vendor/cinch/lib", __FILE__)
4 require "cinch"
aa19332 @alloy Add bot commands for all Trac methods.
alloy authored
5 require "macruby_bugmash_bot/trac"
5df5aaf @alloy Setup spec env.
alloy authored
6
7 bot = Cinch::Bot.new do
8 configure do |c|
aa19332 @alloy Add bot commands for all Trac methods.
alloy authored
9 c.server = "irc.freenode.org"
ef60a13 @alloy Force the feed string to UTF-8, always coerce an ID to an int before usi...
alloy authored
10 c.nick = "BugMash-bot"
5df5aaf @alloy Setup spec env.
alloy authored
11 c.channels = ["#cinch-bots"]
aa19332 @alloy Add bot commands for all Trac methods.
alloy authored
12
13 @trac = Trac.new
5df5aaf @alloy Setup spec env.
alloy authored
14 end
15
a34ce66 @alloy Add a !help banner.
alloy authored
16 HELP = [
17 "‘!gimme’ This command will tell you of a single ticket that is available.",
18 "‘!work <id>’ This command tells the bot that you are now working on a ticket.",
19 "‘!stop <id>’ This command tells the bot that you are no longer working on a ticket.",
20 "‘!status <id>’ This command asks the bot the status of a particular ticket. It will respond by saying who's working on it.",
21 "‘!review <id>’ Marks the ticket for review. MacRuby core will monitor this to see what's ready to be reviewed.",
22 "‘!unreview <id>’ Unmarks the ticket to be reviewed.",
23 "‘!me’ Private messages you telling you the number of tickets you're working on and lists them off.",
24 "‘!marked’ Private messages you telling you what the tickets are that are ready to be reviewed."
25 ]
26
27 on :channel, "!help" do |m|
28 HELP.each { |msg| m.user.send(msg) }
5df5aaf @alloy Setup spec env.
alloy authored
29 end
aa19332 @alloy Add bot commands for all Trac methods.
alloy authored
30
31 on :channel, "!gimme" do |m|
32 m.reply @trac.open_ticket
33 end
34
35 on :channel, /^!work (\d+)/ do |m, id|
36 m.reply @trac.assign_ticket(id, m.user.nick)
37 end
38
39 on :channel, /^!stop (\d+)/ do |m, id|
40 m.reply @trac.resign_from_ticket(id, m.user.nick)
41 end
42
43 on :channel, /^!status (\d+)/ do |m, id|
44 m.reply @trac.ticket_status(id, m.user.nick)
45 end
46
47 on :channel, /^!review (\d+)/ do |m, id|
48 m.reply @trac.mark_for_review(id, m.user.nick)
49 end
50
51 on :channel, /^!unreview (\d+)/ do |m, id|
52 m.reply @trac.unmark_for_review(id, m.user.nick)
53 end
54
55 on :message, "!me" do |m|
56 @trac.user(m.user.nick).each do |msg|
57 m.user.send(msg)
58 end
59 end
60
a34ce66 @alloy Add a !help banner.
alloy authored
61 on :message, "!marked" do |m|
aa19332 @alloy Add bot commands for all Trac methods.
alloy authored
62 @trac.marked_for_review.each do |msg|
63 m.user.send(msg)
64 end
65 end
5df5aaf @alloy Setup spec env.
alloy authored
66 end
67
68 bot.start
Something went wrong with that request. Please try again.