commit 0b0333461f9db1d7b208b4b016de7f8b2e6cd86d from: Izzy Blacklock date: Mon May 15 17:41:09 2023 UTC Added support for verifying requester is authenticated Added support for listing users with email and epoch of last time seen. commit - df7b26189826b401bd00094584d7b6cabed3e8b0 commit + 0b0333461f9db1d7b208b4b016de7f8b2e6cd86d blob - 74f2048db939f0e17d33b3c1879963206ae8abb1 blob + 486c369f0520dfad07d9650dd622651c16d8c600 --- lib/Bot/BasicBot/Pluggable/Module/BotnowDB.pm +++ lib/Bot/BasicBot/Pluggable/Module/BotnowDB.pm @@ -52,8 +52,15 @@ sub disconnectDB { sub listUsers { my $self=shift; my $dbh=$self->connectDB(); - my $stmt=qq{SELECT DISTINCT username from bnc}; - my $reply = join (', ', @{$dbh->selectcol_arrayref($stmt)}); + my $stmt=qq{SELECT DISTINCT username,email,password from bnc}; + my @lines; + for my $usr (@{$dbh->selectall_arrayref($stmt)}) { + my $seen = $self->bot->module('seen')->get("seen_$usr->[0]"); + $seen = {time => 'UNKNOWN'} if (not defined $seen); + next unless (defined $usr->[2]); + push @lines, qq{$usr->[0] : $usr->[1] : $seen->{time}}; + } + my $reply = join ("\n", @lines); $self->disconnectDB($dbh); return $reply; } @@ -97,6 +104,9 @@ sub told { $channel = $message->{who}; } if($body =~ /^botnow/i) { # Only reply if line begins with botnow + if (not $self->bot->module("Auth")->authed($message->{who})) { + return "Please Authenticate"; + } my @cmds = split(' ',$body); shift @cmds; #pop botnow off command list my %actions = (