1- const lodash = require ( 'lodash' ) ;
1+ const lodash = require ( "lodash" ) ;
2+ const packagejson = require ( "../package.json" ) [ "" ]
23
34macro delegate {
45 rule { $property:ident $method:ident } => {
@@ -10,37 +11,37 @@ macro delegate {
1011}
1112
1213const defaultFactoryConfiguration = {
13- ' NetSocket' : require ( ' net' ) . Socket ,
14- ' IrcSocket' : require ( ' irc-socket' ) ,
15- ' IrcOutputSocket' : require ( ' ./output-socket.js' ) ,
16- ' MessageHandler' : require ( ' ./message-handler.js' ) ,
17- ' CommandHandler' : require ( ' ./command-handler.js' ) ,
18- ' Plugins' : require ( ' tennu-plugins' ) ,
19- ' BiSubscriber' : require ( ' ./bisubscriber.js' ) ,
20- ' Logger' : require ( ' ./null-logger.js' ) ,
21- ' NicknameTracker' : require ( ' ./nickname-tracker.js' )
14+ " NetSocket" : require ( " net" ) . Socket ,
15+ " IrcSocket" : require ( " irc-socket" ) ,
16+ " IrcOutputSocket" : require ( " ./output-socket.js" ) ,
17+ " MessageHandler" : require ( " ./message-handler.js" ) ,
18+ " CommandHandler" : require ( " ./command-handler.js" ) ,
19+ " Plugins" : require ( " tennu-plugins" ) ,
20+ " BiSubscriber" : require ( " ./bisubscriber.js" ) ,
21+ " Logger" : require ( " ./null-logger.js" ) ,
22+ " NicknameTracker" : require ( " ./nickname-tracker.js" )
2223} ;
2324
2425const defaultClientConfiguration = {
2526 // IrcSocket Config
26- ' server' : undefined ,
27- ' port' : 6667 ,
28- ' ipv6' : undefined ,
29- ' localAddress' : undefined ,
30- ' secure' : false ,
31- ' password' : undefined ,
32- ' capab' : false ,
33- ' nickname' : ' tennubot' ,
34- ' username' : ' tennu' ,
35- ' realname' : ' tennu 0.9.x' ,
27+ " server" : undefined ,
28+ " port" : 6667 ,
29+ " ipv6" : undefined ,
30+ " localAddress" : undefined ,
31+ " secure" : false ,
32+ " password" : undefined ,
33+ " capab" : false ,
34+ " nickname" : " tennubot" ,
35+ " username" : " tennu" ,
36+ " realname" : " tennu " + require ( "../package.json" ) [ "version" ] ,
3637
3738 // Tennu Config
38- ' channels' : [ ] ,
39- ' nickserv' : ' nickserv' ,
40- ' auth-password' : undefined ,
41- ' plugins' : [ ] ,
42- ' command-trigger' : '!' ,
43- ' disable-help' : false
39+ " channels" : [ ] ,
40+ " nickserv" : " nickserv" ,
41+ " auth-password" : undefined ,
42+ " plugins" : [ ] ,
43+ " command-trigger" : "!" ,
44+ " disable-help" : false
4445} ;
4546
4647/** Fields
@@ -54,7 +55,7 @@ const defaultClientConfiguration = {
5455 */
5556 const Client = function ( config , dependencies ) {
5657 if ( config . nick || config . user ) {
57- throw new Error ( ' Please use \' nickname\' and \' username\' instead of \' nick\' and \' user\' in your configuration.' ) ;
58+ throw new Error ( " Please use \" nickname\" and \" username\" instead of \" nick\" and \" user\" in your configuration." ) ;
5859 }
5960
6061 const client = Object . create ( Client . prototype ) ;
@@ -92,16 +93,16 @@ const defaultClientConfiguration = {
9293 // determining whether they should be handled by the IrcMessageEmitter
9394 // or the Command Handler.
9495 client . _subscriber = new di . BiSubscriber ( client . _messageHandler , commandHandler ) ;
95- client . _subscriber . on ( ' privmsg' , function ( privmsg ) { commandHandler . parse ( privmsg ) ; } ) ;
96+ client . _subscriber . on ( " privmsg" , function ( privmsg ) { commandHandler . parse ( privmsg ) ; } ) ;
9697
9798 // And finally, the module system.
98- client . _plugins = new di . Plugins ( ' tennu' , client ) ;
99- client . _plugins . addHook ( ' handlers' , function ( module , handlers ) {
99+ client . _plugins = new di . Plugins ( " tennu" , client ) ;
100+ client . _plugins . addHook ( " handlers" , function ( module , handlers ) {
100101 client . _subscriber . on ( handlers ) ;
101102 } ) ;
102- client . note ( ' Tennu' , ' Loading default plugins' ) ;
103- client . _plugins . use ( [ ' server' , ' help' , ' user' , ' channel' , ' startup' ] , __dirname ) ;
104- client . note ( ' Tennu' , ' Loading your plugins' ) ;
103+ client . note ( " Tennu" , " Loading default plugins" ) ;
104+ client . _plugins . use ( [ " server" , " help" , " user" , " channel" , " startup" ] , __dirname ) ;
105+ client . note ( " Tennu" , " Loading your plugins" ) ;
105106 client . _plugins . use ( config . plugins || [ ] , process . cwd ( ) ) ;
106107
107108
@@ -112,7 +113,7 @@ const defaultClientConfiguration = {
112113
113114 client . connected = false ;
114115
115- client . note ( ' Tennu' , ' Client created.' ) ;
116+ client . note ( " Tennu" , " Client created." ) ;
116117 return client ;
117118} ;
118119
@@ -125,33 +126,33 @@ Client.prototype.config = function (param) {
125126// implements Runnable ;)
126127
127128const connect = function ( ) {
128- this . debug ( ' Tennu' , ' Trying to connect.' ) ;
129+ this . debug ( " Tennu" , " Trying to connect." ) ;
129130
130131 if ( this . connected ) {
131- this . warn ( ' Tennu' , ' Attempted to start Tennu Client that already is connected.' ) ;
132+ this . warn ( " Tennu" , " Attempted to start Tennu Client that already is connected." ) ;
132133 return ;
133134 }
134135
135136 this . _socket . connect ( ) ;
136137 this . connected = true ;
137- this . debug ( ' Tennu' , ' Connected' ) ;
138+ this . debug ( " Tennu" , " Connected" ) ;
138139 return this ;
139140}
140141
141142Client . prototype . connect = connect ;
142143Client . prototype . start = connect ;
143144
144145const disconnect = function ( ) {
145- this . debug ( ' Tennu' , ' Trying to disconnect.' ) ;
146+ this . debug ( " Tennu" , " Trying to disconnect." ) ;
146147
147148 if ( ! this . connected ) {
148- this . warn ( ' Tennu' , ' Attempted to end Tennu Client that already is not connected.' ) ;
149+ this . warn ( " Tennu" , " Attempted to end Tennu Client that already is not connected." ) ;
149150 return this ;
150151 }
151152
152153 this . _socket . end ( ) ;
153154 this . connected = false ;
154- this . debug ( ' Tennu' , ' Disconnected' ) ;
155+ this . debug ( " Tennu" , " Disconnected" ) ;
155156 return this ;
156157} ;
157158
0 commit comments