forked from GitHub/dbot
		
	Forgot to add ignore.api to last commit
This commit is contained in:
		
							parent
							
								
									b56ac4164a
								
							
						
					
					
						commit
						53c8ca9672
					
				
							
								
								
									
										30
									
								
								modules/ignore/api.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								modules/ignore/api.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | ||||
| var _ = require('underscore')._, | ||||
|     databank = require('databank'), | ||||
|     AlreadyExistsError = databank.AlreadyExistsError, | ||||
|     NoSuchThingError = databank.NoSuchThingError, | ||||
|     NotImplementedError = databank.NotImplementedError; | ||||
| 
 | ||||
| var api = function(dbot) { | ||||
|     return { | ||||
|         'isUserIgnoring': function(server, user, item, callback) { | ||||
|             dbot.api.users.resolveUser(server, user, function(user) { | ||||
|                 this.db.read('ignores', user.id, function(err, ignores) { | ||||
|                     var isIgnoring = false; | ||||
|                     if(ignores) { | ||||
|                         if(_.has(dbot.commands, item)) { | ||||
|                             item = moduleName = dbot.commands[item].module; | ||||
|                         } | ||||
|                         if(_.include(ignores.ignores, item)) { | ||||
|                             isIgnoring = true; | ||||
|                         } | ||||
|                     } | ||||
|                     callback(isIgnoring); | ||||
|                 }); | ||||
|             }.bind(this)); | ||||
|         } | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| exports.fetch = function(dbot) { | ||||
|     return api(dbot); | ||||
| }; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 reality
						reality