Skip to content
Newer
Older
100644 95 lines (78 sloc) 3.41 KB
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 8, 2012
1 # Description:
2 # wunderlist allows you to add todos to your wunderlist directly from hubot
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
3 #
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 9, 2012
4 # Dependencies:
5 # "mailer": "0.6.7"
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
6 #
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 9, 2012
7 # Configuration:
8 # HUBOT_WUNDERLIST_SMTP_HOST - your smtp host e.g. smtp.gmail.com
9 # HUBOT_WUNDERLIST_SMTP_PORT - the port to connect to
109f962 @yaotti Fix a typo
yaotti authored Feb 8, 2014
10 # HUBOT_WUNDERLIST_SMTP_USESSL - whether you want to connect via SSL
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 9, 2012
11 # HUBOT_WUNDERLIST_SMTP_SENDDOMAIN - the domain from which to send
12 # HUBOT_WUNDERLIST_SMTP_USEAUTH - BOOL: authentication required
13 # HUBOT_WUNDERLIST_SMTP_AUTH_NAME - username for authentication
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
14 # HUBOT_WUNDERLIST_SMTP_AUTH_PASSWORD - password for authentication
15 #
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 9, 2012
16 # Commands:
17 # hubot wunderlist all the users - display all users which have registered
18 # hubot wunderlist add me with <email> - add <email> as wunderlist login
19 # hubot wunderlist my login - display your wunderlist email
20 # hubot wunderlist forget me - remove the wunderlist login
21 # hubot wunderlist me <a todo> - adds the todo to your wunderlist Inbox
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
22 #
3406d66 @technicalpickles Update "w" help comments
technicalpickles authored Jun 9, 2012
23 # Notes:
24 # Currently all todos are added to the Inbox.
2e1951c @tombell Trim blank line comments, and fix up issues
tombell authored Jun 9, 2012
25 #
26 # Author:
27 # mrtazz
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
28
29 mail = require 'mailer'
30
31 module.exports = (robot) ->
32
33 robot.respond /wunderlist all the users/i, (msg) ->
34 theReply = "Here is who I know:\n"
35
46e6478 @robertfwest Update calls of the user* functions
robertfwest authored Jan 31, 2013
36 for own key, user of robot.brain.users
e9d455e @mrtazz add wunderlist command
mrtazz authored Dec 6, 2011
37 if(user.wunderlistmail)
38 theReply += user.name + " is " + user.wunderlistmail + "\n"
39
40 msg.send theReply
41
42 robot.respond /wunderlist add me with ([\w\d-_.]+@[\w\d-_.]+)/i, (msg) ->
43 wunderlistmail = msg.match[1]
44 msg.message.user.wunderlistmail = wunderlistmail
45 msg.send "Ok, you are " + wunderlistmail + " on Wunderlist"
46
47 robot.respond /wunderlist my login/i, (msg) ->
48 user = msg.message.user
49 if user.wunderlistmail
50 msg.reply "You are known as " + user.wunderlistmail + " on Wunderlist"
51 else
52 text = "I don't know who you are. You should probably identify yourself"
53 text += "with your Wunderlist login"
54 msg.reply text
55
56 robot.respond /wunderlist forget me/i, (msg) ->
57 user = msg.message.user
58 user.wunderlistmail = null
59
60 msg.reply("Ok, I have no idea who you are anymore.")
61
62 robot.respond /wunderlist me (.*)/i, (msg) ->
63 todo = msg.match[1]
64 wunderlistmail = msg.message.user.wunderlistmail
65 # change list here
66 subject = "Inbox"
67
68 # option settings
69 options = {
70 host : process.env.HUBOT_WUNDERLIST_SMTP_HOST ,
71 port : process.env.HUBOT_WUNDERLIST_SMTP_PORT or 25 ,
72 ssl : process.env.HUBOT_WUNDERLIST_SMTP_USESSL or true ,
73 domain : process.env.HUBOT_WUNDERLIST_SMTP_SENDDOMAIN or 'localhost',
74 authentication : process.env.HUBOT_WUNDERLIST_SMTP_USEAUTH or false ,
75 username : process.env.HUBOT_WUNDERLIST_SMTP_AUTH_NAME ,
76 password : process.env.HUBOT_WUNDERLIST_SMTP_AUTH_PASSWORD
77 }
78
79 if (options.host)
80
81
82 options.authentication = if options.authentication is true then 'login' else 'none'
83 options.to = 'me@wunderlist.com'
84 options.from = wunderlistmail
85 options.subject = subject
86 options.body = todo
87
88 mail.send options, (err, result) ->
89 console.log(err)
90 if (err)
91 msg.reply "I'm sorry, I couldn't add your todo."
92 else
93 msg.reply "Your todo was added."
94
Something went wrong with that request. Please try again.