@@ -32,7 +32,7 @@ module.exports = function init(options){
32
32
33
33
34
34
webserver . get ( '/karma' , function ( req , res , next ) {
35
- res . sendFile ( '. /index.html') ;
35
+ res . sendFile ( __dirname + ' /index.html') ;
36
36
} ) ;
37
37
38
38
webserver . get ( '/karma/:channel' , function ( req , res , next ) {
@@ -84,6 +84,7 @@ module.exports = function init(options){
84
84
85
85
return {
86
86
"^(\\S+)\\+\\+$" : function ( from , matches ) {
87
+ if ( bot . chans [ channel . name ] . users [ matches [ 1 ] ] === undefined ) return channel . say ( from + ': no nick matching that was found' ) ;
87
88
matches [ 1 ] = cleanName ( matches [ 1 ] ) ;
88
89
if ( from . toLowerCase ( ) == matches [ 1 ] ) return ;
89
90
if ( cooldown [ from ] ) return channel . say ( from + ': you must wait an hour between giving karma' ) ;
@@ -92,6 +93,7 @@ module.exports = function init(options){
92
93
saveKarma ( from , matches [ 1 ] ) ;
93
94
} ,
94
95
"^(\\S+)\\-\\-$" : function ( from , matches ) {
96
+ if ( bot . chans [ channel . name ] . users [ matches [ 1 ] ] === undefined ) return channel . say ( from + ': no nick matching that was found' ) ;
95
97
matches [ 1 ] = cleanName ( matches [ 1 ] ) ;
96
98
if ( from . toLowerCase ( ) == matches [ 1 ] ) return ;
97
99
if ( cooldown [ from ] ) return channel . say ( from + ': you must wait an hour between giving karma' ) ;
@@ -100,10 +102,11 @@ module.exports = function init(options){
100
102
saveKarma ( from , matches [ 1 ] ) ;
101
103
} ,
102
104
"^!karma(?: (\\S+))?$" : function ( from , matches ) {
103
- if ( matches [ 1 ] ) from = matches [ 1 ] ;
104
- from = cleanName ( from ) ;
105
- checkKarma ( from ) ;
106
- sayKarma ( from ) ;
105
+ if ( matches [ 1 ] ) nick = matches [ 1 ] ;
106
+ nick = cleanName ( nick ) ;
107
+ if ( bot . chans [ channel . name ] . users [ nick ] === undefined ) return channel . say ( from + ': no nick matching that was found' ) ;
108
+ checkKarma ( nick ) ;
109
+ sayKarma ( nick ) ;
107
110
}
108
111
} ;
109
112
} ;
0 commit comments