mirror of
				https://github.com/pragma-/pbot.git
				synced 2025-11-04 00:27:23 +01:00 
			
		
		
		
	Core/Handlers: Do not auto-reply to NOTICEs
This commit is contained in:
		
							parent
							
								
									2b36286c22
								
							
						
					
					
						commit
						48daaa91ca
					
				@ -26,23 +26,14 @@ sub on_notice($self, $event_type, $event) {
 | 
			
		||||
        $event->{args}[0],
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    # don't handle non-chat NOTICE
 | 
			
		||||
    # don't handle server NOTICE
 | 
			
		||||
    return undef if $to eq '*';
 | 
			
		||||
 | 
			
		||||
    # log notice
 | 
			
		||||
    $self->{pbot}->{logger}->log("NOTICE from $nick!$user\@$host to $to: $text\n");
 | 
			
		||||
 | 
			
		||||
    # if NOTICE is sent to the bot then replace the `to` field with the
 | 
			
		||||
    # sender's nick instead so when we pass it on to on_public ...
 | 
			
		||||
    if ($to eq $self->{pbot}->{registry}->get_value('irc', 'botnick')) {
 | 
			
		||||
        $event->{to}[0] = $nick;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # handle this NOTICE as a public message
 | 
			
		||||
    # (check for bot commands, anti-flooding, etc)
 | 
			
		||||
    $self->on_public($event_type, $event);
 | 
			
		||||
 | 
			
		||||
    return 1;
 | 
			
		||||
    # nothing further to do with NOTICEs
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub on_public($self, $event_type, $event) {
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,7 @@ sub on_notice($self, $event_type, $event) {
 | 
			
		||||
    # notice from NickServ
 | 
			
		||||
    if (lc $nick eq lc $nickserv) {
 | 
			
		||||
        # log notice
 | 
			
		||||
        $self->{pbot}->{logger}->log("NOTICE from $nick!$user\@$host to $to: $text\n");
 | 
			
		||||
        $self->{pbot}->{logger}->log("Services NOTICE from $nick!$user\@$host to $to: $text\n");
 | 
			
		||||
 | 
			
		||||
        # if we have enabled NickServ GUARD protection and we're not identified yet,
 | 
			
		||||
        # NickServ will warn us to identify -- this is our cue to identify.
 | 
			
		||||
 | 
			
		||||
@ -25,8 +25,8 @@ use PBot::Imports;
 | 
			
		||||
# These are set by the /misc/update_version script
 | 
			
		||||
use constant {
 | 
			
		||||
    BUILD_NAME     => "PBot",
 | 
			
		||||
    BUILD_REVISION => 4674,
 | 
			
		||||
    BUILD_DATE     => "2023-05-11",
 | 
			
		||||
    BUILD_REVISION => 4675,
 | 
			
		||||
    BUILD_DATE     => "2023-05-14",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
sub initialize {}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user