1
- Robot = require (' hubot' ).robot ()
2
- Adapter = require (' hubot' ).adapter ()
1
+ Robot = require (' hubot' ).Robot
2
+ Adapter = require (' hubot' ).Adapter
3
+ TextMessage = require (' hubot' ).TextMessage
3
4
4
5
Irc = require ' irc'
5
6
6
7
class IrcBot extends Adapter
7
- constructor : (@robot ) ->
8
- super @robot
9
-
10
- @robot .notice = (user , strings ... ) ->
11
- @adapter .notice user, strings...
12
-
13
- @robot .Response = IrcResponse
14
-
15
8
send : (user , strings ... ) ->
16
9
for str in strings
17
10
if not str?
@@ -48,6 +41,12 @@ class IrcBot extends Adapter
48
41
@bot .part channel, () ->
49
42
console .log (' left %s' , channel)
50
43
44
+ kick : (channel , client , message ) ->
45
+ @bot .emit ' raw' ,
46
+ command : ' KICK'
47
+ nick : process .env .HUBOT_IRC_NICK
48
+ args : [ channel, client, message ]
49
+
51
50
command : (command , strings ... ) ->
52
51
@bot .send command, strings...
53
52
@@ -110,7 +109,7 @@ class IrcBot extends Adapter
110
109
user .room = null
111
110
console .log " msg <#{ from } > #{ message} "
112
111
113
- self .receive new Robot. TextMessage (user, message)
112
+ self .receive new TextMessage (user, message)
114
113
115
114
bot .addListener ' error' , (message ) ->
116
115
console .error (' ERROR: %s: %s' , message .command , message .args .join (' ' ))
@@ -135,7 +134,7 @@ class IrcBot extends Adapter
135
134
136
135
self .emit " connected"
137
136
138
- class IrcResponse extends Robot. Response
137
+ class IrcResponse extends Response
139
138
notice : (strings ... ) ->
140
139
@robot .adapter .notice @message .user , strings...
141
140
0 commit comments