/
todobot.rb
31 lines (27 loc) · 860 Bytes
/
todobot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env ruby
require 'rubygems'
require 'jabber/bot'
@jabber_id = 'you@yourdomain.com/dir'#Using a location because I had problems connecting with dreamhost
@password = 'password'
@todoscript = '/Users/home/todo.sh -p -v -f' #Make sure you have -f otherwise deletions fail
@masters = ['address@host.com', 'another@wherever.com'] #Add any emails that you want to be able to access this
# Create a public Jabber::Bot
bot = Jabber::Bot.new(
:jabber_id => @jabber_id,
:password => @password,
:master => @masters,
:is_public => false
)
bot.add_command(
:syntax => 'todo <string>',
:description => 'View Todos',
:regex => /^todo\s+.+$/,
:alias => [
:syntax => 't <string>',
:regex => /^t\s+.+$/
]
) do |sender, command|
%x[#{@todoscript} #{command}]
end
# Bring your new bot to life
bot.connect