mirror of
				https://github.com/pragma-/pbot.git
				synced 2025-11-04 08:37:24 +01:00 
			
		
		
		
	Factoids: add more pastebin URLs for factadd -url; update help URL to point at TOC
				
					
				
			This commit is contained in:
		
							parent
							
								
									77a24faf02
								
							
						
					
					
						commit
						38d9c86984
					
				@ -689,6 +689,14 @@ sub cmd_add_regex {
 | 
			
		||||
    return "/say $keyword added.";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# FIXME: use registry array instead
 | 
			
		||||
my @valid_pastesites = (
 | 
			
		||||
    'https?://sprunge.us',
 | 
			
		||||
    'https?://ix.io',
 | 
			
		||||
    'https?://dpaste.com',
 | 
			
		||||
    'https?://0x0.st',
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
sub cmd_factadd {
 | 
			
		||||
    my ($self, $context) = @_;
 | 
			
		||||
 | 
			
		||||
@ -728,8 +736,8 @@ sub cmd_factadd {
 | 
			
		||||
            my ($url) = $self->{pbot}->{interpreter}->split_args(\@arglist, 1);
 | 
			
		||||
 | 
			
		||||
            # FIXME: move this to registry
 | 
			
		||||
            if ($url !~ m/^https?:\/\/(?:sprunge.us|ix.io)\/\w+$/) {
 | 
			
		||||
                return "Invalid URL: acceptable URLs are: http://sprunge.us, http://ix.io";
 | 
			
		||||
            if (not grep { $url =~ m/^$_/i } @valid_pastesites) {
 | 
			
		||||
                return "Invalid URL: acceptable URLs are: " . join(', ', sort @valid_pastesites);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            # create a UserAgent
 | 
			
		||||
@ -1314,7 +1322,9 @@ sub cmd_factchange {
 | 
			
		||||
 | 
			
		||||
    if (defined $url) {
 | 
			
		||||
        # FIXME: move this to registry
 | 
			
		||||
        if ($url !~ m/^https?:\/\/(?:sprunge.us|ix.io)\/\w+$/) { return "Invalid URL: acceptable URLs are: http://sprunge.us, http://ix.io"; }
 | 
			
		||||
        if (not grep { $url =~ m/^$_/i } @valid_pastesites) {
 | 
			
		||||
            return "Invalid URL: acceptable URLs are: " . join(', ', sort @valid_pastesites);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        my $ua       = LWP::UserAgent->new(timeout => 10);
 | 
			
		||||
        my $response = $ua->get($url);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user