[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for botnow to verify username exists before aproval


--- BNC.pm	Sat Mar 11 21:34:28 2023
+++ /home/botnow/BNC.pm	Fri Apr 14 12:53:04 2023
@@ -121,9 +121,13 @@
 		return;
 	} elsif (main::isstaff($bot, $nick) && $text =~ /^approve\s+([[:ascii:]]+)/) {
 		my $username = $1;
-		main::putserv($bot, "PRIVMSG *blockuser :unblock $username");
-		foreach my $chan (@teamchans) {
-			main::putserv($bot, "PRIVMSG $chan :$username bnc approved");
+		if (SQLite::selectrows("bnc", "username", $username)) {
+			main::putserv($bot, "PRIVMSG *blockuser :unblock $username");
+			foreach my $chan (@teamchans) {
+				main::putserv($bot, "PRIVMSG $chan :$username bnc approved");
+			}
+		} else {
+			main::putserv($bot, "PRIVMSG $chan :$username hasn't requested a bnc account");
 		}
 		return;
 	} elsif ($staff =~ /$nick/ && $text =~ /^cloneuser$/i) {