|
5 | 5 | Irc = require 'irc' |
6 | 6 |
|
7 | 7 | class IrcBot extends Adapter |
8 | | - send: (user, strings...) -> |
| 8 | + send: (envelope, strings...) -> |
9 | 9 | for str in strings |
10 | 10 | if not str? |
11 | 11 | continue |
12 | | - if user.room |
13 | | - console.log "#{user.room} #{str}" |
14 | | - @bot.say(user.room, str) |
15 | | - else if user.name |
16 | | - console.log "#{user.name} #{str}" |
17 | | - @bot.say(user.name, str) |
| 12 | + if envelope.user.room |
| 13 | + console.log "#{envelope.user.room} #{str}" |
| 14 | + @bot.say(envelope.user.room, str) |
| 15 | + else if envelope.user.name |
| 16 | + console.log "#{envelope.user.name} #{str}" |
| 17 | + @bot.say(envelope.user.name, str) |
18 | 18 | else |
19 | | - console.log "#{user} #{str}" |
20 | | - @bot.say(user, str) |
| 19 | + console.log "#{envelope.user} #{str}" |
| 20 | + @bot.say(envelope.user, str) |
21 | 21 |
|
22 | | - notice: (user, strings...) -> |
| 22 | + notice: (envelope, strings...) -> |
23 | 23 | for str in strings |
24 | 24 | if not str? |
25 | 25 | continue |
26 | | - if user.room |
27 | | - console.log "notice #{user.room} #{str}" |
28 | | - @bot.notice(user.room, str) |
| 26 | + if envelope.user.room |
| 27 | + console.log "notice #{envelope.user.room} #{str}" |
| 28 | + @bot.notice(envelope.user.room, str) |
29 | 29 | else |
30 | | - console.log "notice #{user.name} #{str}" |
31 | | - @bot.notice(user.name, str) |
| 30 | + console.log "notice #{envelope.user.name} #{str}" |
| 31 | + @bot.notice(envelope.user.name, str) |
32 | 32 |
|
33 | | - reply: (user, strings...) -> |
| 33 | + reply: (envelope, strings...) -> |
34 | 34 | for str in strings |
35 | | - @send user, "#{user.name}: #{str}" |
| 35 | + @send envelope.user, "#{envelope.user.name}: #{str}" |
36 | 36 |
|
37 | 37 | join: (channel) -> |
38 | 38 | self = @ |
|
0 commit comments