mirror of
				https://github.com/pragma-/pbot.git
				synced 2025-11-04 00:27:23 +01:00 
			
		
		
		
	Commands: Fix cmdset, cmdunset and help commands
This commit is contained in:
		
							parent
							
								
									8d0d5bc711
								
							
						
					
					
						commit
						d4d9b37e76
					
				@ -39,7 +39,7 @@ sub cmd_set {
 | 
			
		||||
        return "Usage: cmdset <command> [key [value]]";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $self->{metadata}->set($command, $key, $value);
 | 
			
		||||
    return $self->{pbot}->{commands}->{metadata}->set($command, $key, $value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cmd_unset {
 | 
			
		||||
@ -51,7 +51,7 @@ sub cmd_unset {
 | 
			
		||||
        return "Usage: cmdunset <command> <key>";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $self->{metadata}->unset($command, $key);
 | 
			
		||||
    return $self->{pbot}->{commands}->{metadata}->unset($command, $key);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,6 @@ sub new {
 | 
			
		||||
 | 
			
		||||
sub initialize {
 | 
			
		||||
    my ($self, %conf) = @_;
 | 
			
		||||
 | 
			
		||||
    $self->{pbot}->{commands}->register(sub { $self->cmd_help(@_) }, 'help');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -38,13 +37,13 @@ sub cmd_help {
 | 
			
		||||
    my $keyword = lc $self->{pbot}->{interpreter}->shift_arg($context->{arglist});
 | 
			
		||||
 | 
			
		||||
    # check built-in commands first
 | 
			
		||||
    if ($self->exists($keyword)) {
 | 
			
		||||
    if ($self->{pbot}->{commands}->exists($keyword)) {
 | 
			
		||||
 | 
			
		||||
        # check for command metadata
 | 
			
		||||
        if ($self->{metadata}->exists($keyword)) {
 | 
			
		||||
            my $name         = $self->{metadata}->get_key_name($keyword);
 | 
			
		||||
            my $requires_cap = $self->{metadata}->get_data($keyword, 'requires_cap');
 | 
			
		||||
            my $help         = $self->{metadata}->get_data($keyword, 'help');
 | 
			
		||||
        if ($self->{pbot}->{commands}->{metadata}->exists($keyword)) {
 | 
			
		||||
            my $name         = $self->{pbot}->{commands}->{metadata}->get_key_name($keyword);
 | 
			
		||||
            my $requires_cap = $self->{pbot}->{commands}->{metadata}->get_data($keyword, 'requires_cap');
 | 
			
		||||
            my $help         = $self->{pbot}->{commands}->{metadata}->get_data($keyword, 'help');
 | 
			
		||||
 | 
			
		||||
            my $result = "/say $name: ";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user