diff options
author | Krytarik Raido <krytarik@gmail.com> | 2021-02-04 04:27:04 +0100 |
---|---|---|
committer | Krytarik Raido <krytarik@gmail.com> | 2021-02-04 04:27:04 +0100 |
commit | 5ca5026a1cea837937dffaa4f51288261862c846 (patch) | |
tree | 9c4a30aacd9ff82a2014affa7dea9ba9a9a2e3a2 | |
parent | 0d415eb991533f85b908801ba9e05b0c08fcc82f (diff) | |
download | antispammeta-5ca5026a1cea837937dffaa4f51288261862c846.tar.bz2 antispammeta-5ca5026a1cea837937dffaa4f51288261862c846.tar.xz antispammeta-5ca5026a1cea837937dffaa4f51288261862c846.tar.zst |
Various improvements.
* Also catch "!op" call.
* Improve op alert output.
* Define URLs specific to bot
instance via configuration.
-rw-r--r-- | config-default/settings.json | 6 | ||||
-rw-r--r-- | lib/ASM/Commander.pm | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/config-default/settings.json b/config-default/settings.json index c976383..d396d3d 100644 --- a/config-default/settings.json +++ b/config-default/settings.json @@ -29,12 +29,16 @@ "ssl" : "1", "username" : "MetaBot", "web" : { + "userfile" : "/var/www/.htpasswd", "groupfile" : "/var/www/.htgroup", "shortener" : { "apikey" : "yoursecretkey", "domain" : "yourls.org", "secure" : "0" }, - "userfile" : "/var/www/.htpasswd" + "detectdir" : "https://antispammeta.net/detectlogs/", + "htmlbase" : "https://antispammeta.net/", + "cgibase" : "https://antispammeta.net/cgi-bin/", + "cgisbase" : "https://antispammeta.net/cgi-bin/secret/" } } diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index df73589..c63952d 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -119,7 +119,7 @@ my $cmdtbl = { 'cmd' => \&cmd_restrict }, q{(?x) ^ \s* # start of line, optional whitespace - \!ops # actual command + \!ops? # actual command (?: # optionally: \s+ # spaces (?<chan> \# \S+ ) # channel name @@ -459,7 +459,7 @@ sub cmd_help2 { sub cmd_db { my ($conn, $event) = @_; - $conn->privmsg($event->replyto, "db is at http://antispammeta.net/query.html"); + $conn->privmsg($event->replyto, "db is at $::settings->{web}->{querybase}query.html"); } sub sql_wildcard { @@ -495,7 +495,7 @@ sub cmd_investigate { my $nick = lc $+{nick}; unless (defined($::sn{$nick})) { $conn->privmsg($event->replyto, "I don't see $nick in my state tracking database, so I can't run any queries on their info, sorry :(" . - " You can try https://antispammeta.net/cgi-bin/secret/investigate.pl?nick=$nick instead!"); + " You can try $::settings->{web}->{cgisbase}investigate.pl?nick=$nick instead!"); return; } my $person = $::sn{$nick}; @@ -556,7 +556,7 @@ sub cmd_investigate { my $query_string = join '&', @queries; $conn->privmsg( $event->replyto, "I found $all_found. " . - ASM::Shortener->shorturl("https://antispammeta.net/cgi-bin/secret/investigate.pl?$query_string") ); + ASM::Shortener->shorturl("$::settings->{web}->{cgisbase}investigate.pl?$query_string") ); } sub cmd_investigate2 { @@ -979,7 +979,7 @@ sub cmd_ops { my $hilite=ASM::Util->commaAndify(ASM::Util->getAlert($tgt, 'opalert', 'hilights')); my $txtz = "[\x02$tgt\x02] - $event->{nick} wants op attention"; if ((time-$::sc{$tgt}{users}{$nick}{jointime}) > 90) { - $txtz .= " ($msg) $hilite !att-$tgt-opalert"; + $txtz .= " (" . (defined($msg) ? $msg : '') . ")" . ($hilite ? " $hilite" : '') . " !att-$tgt-opalert"; $::ignored{$tgt} = $::RISKS{'opalert'}; $conn->schedule(45, sub { delete($::ignored{$tgt}) if $::ignored{$tgt} == $::RISKS{'opalert'} }); } |