mirror of
				https://github.com/reality/dbot.git
				synced 2025-11-04 02:17:36 +01:00 
			
		
		
		
	
							parent
							
								
									68b0977bae
								
							
						
					
					
						commit
						e1629f3a16
					
				@ -5,18 +5,18 @@ var api = function(dbot) {
 | 
			
		||||
        /**
 | 
			
		||||
         * Does the user have the correct access level to use the command?
 | 
			
		||||
         */
 | 
			
		||||
        'hasAccess': function(server, user, command, callback) {
 | 
			
		||||
        'hasAccess': function(user, command, callback) {
 | 
			
		||||
            var accessNeeded = dbot.commands[command].access;
 | 
			
		||||
 | 
			
		||||
            if(accessNeeded == 'admin' || accessNeeded == 'moderator') {
 | 
			
		||||
                var allowedNicks = dbot.config.admins;
 | 
			
		||||
                if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators); 
 | 
			
		||||
 | 
			
		||||
                if(!_.include(allowedNicks, user)) {
 | 
			
		||||
                if(!_.include(allowedNicks, user.primaryNick)) {
 | 
			
		||||
                    callback(false);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if(_.has(dbot.modules, 'nickserv') && this.config.useNickserv == true) {
 | 
			
		||||
                        dbot.api.nickserv.auth(server, user, function(result) {
 | 
			
		||||
                        dbot.api.nickserv.auth(user.server, user.currentNick, function(result) {
 | 
			
		||||
                            callback(result);
 | 
			
		||||
                        });
 | 
			
		||||
                    } else {
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ var command = function(dbot) {
 | 
			
		||||
            }
 | 
			
		||||
        } 
 | 
			
		||||
       
 | 
			
		||||
        this.api.hasAccess(event.server, event.user, commandName, function(hasAccess) {
 | 
			
		||||
        this.api.hasAccess(event.rUser, commandName, function(hasAccess) {
 | 
			
		||||
            dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) {
 | 
			
		||||
                dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) {
 | 
			
		||||
                    if(isBanned) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user