mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +01:00
Fix and clean up factadd -url (todo: forking)
This commit is contained in:
parent
3fb72f73c5
commit
dea44fb405
@ -964,7 +964,11 @@ sub factadd {
|
|||||||
$self->{pbot}->{interpreter}->shift_arg(\@arglist);
|
$self->{pbot}->{interpreter}->shift_arg(\@arglist);
|
||||||
|
|
||||||
# the URL is the remaining arguments
|
# the URL is the remaining arguments
|
||||||
($url) = $self->{pbot}->{interpreter}->split_args(\@arglist, 1);
|
my ($url) = $self->{pbot}->{interpreter}->split_args(\@arglist, 1);
|
||||||
|
|
||||||
|
if ($url !~ m/^https?:\/\/(?:sprunge.us|ix.io)\/\w+$/) {
|
||||||
|
return "Invalid URL: acceptable URLs are: https://sprunge.us, https://ix.io";
|
||||||
|
}
|
||||||
|
|
||||||
# create a UserAgent
|
# create a UserAgent
|
||||||
my $ua = LWP::UserAgent->new(timeout => 10);
|
my $ua = LWP::UserAgent->new(timeout => 10);
|
||||||
@ -990,7 +994,7 @@ sub factadd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (not defined $from_chan or not defined $text or not defined $keyword) {
|
if (not defined $from_chan or not defined $text or not defined $keyword) {
|
||||||
return "Usage: factadd [-f] [channel] <keyword> <factoid>; -f to force overwrite";
|
return "Usage: factadd [-f] [channel] <keyword> (<factoid> | -url <paste site>); -f to force overwrite; -url to download from paste site";
|
||||||
}
|
}
|
||||||
|
|
||||||
$from_chan = '.*' if $from_chan !~ /^#/;
|
$from_chan = '.*' if $from_chan !~ /^#/;
|
||||||
|
Loading…
Reference in New Issue
Block a user