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

patch for botnow to only display help messages for loaded modules


--- Help.pm	Sat Mar 11 21:34:28 2023
+++ /home/botnow/Help.pm	Fri Apr 14 12:43:51 2023
@@ -24,24 +24,41 @@
 sub help {
 	my ($bot, $nick, $host, $hand, @args) = @_;
 	my ($chan, $text);
-	my $msg = <<"EOF";
-$terms
-To request a free bouncer, type !bnc <username> <email>. For example, !bnc john john\@example.com.
-To request a free shell account, type !shell <username> <email>. For example, !shell john john\@example.com.
-To request a free email account, type !mail <username> <email>. For example, !mail john john\@example.com.
-EOF
-#To request a free VPN account, type !vpn <username> <email>. For example, !vpn john john\@example.com.
-	if (main::isstaff($bot, $nick)) {
-		$msg .= <<"EOF";
+	my $mod_msgs={
+		BNC => qq(To request a free bouncer, type !bnc <username> <email>. For example, !bnc john john\@example.com.),
+		Shell => qq(To request a free shell account, type !shell <username> <email>. For example, !shell john john\@example.com.),
+		Mail => qq(To request a free email account, type !mail <username> <email>. For example, !mail john john\@example.com.),
+		VPN => qq(To request a free VPN account, type !vpn <username> <email>. For example, !vpn john john\@example.com.)
+	};
+	my $msg = $terms."\n";
+	for my $mod (split ' ',$conf{modules}) {
+		if (exists $mod_msgs->{$mod}) {
+			$msg.=$mod_msgs->{$mod}."\n";
+		}
+	}
+
+	my $mod_admin_msgs={
+			BNC =>  <<"EOF",
 To delete a bouncer, type !bnc delete <username>
 To verify a captcha, type !bnc captcha <username>
 To approve a bouncer, type !bnc approve <username>
 To recreate cloneuser, type !bnc cloneuser
+EOF
+			Shell => <<"EOF",
+To delete a shell account, type !shell delete <username>
+To verify a captcha, type !shell captcha <username>
+EOF
+	};
+	if (main::isstaff($bot, $nick)) {
+		for my $mod (split ' ',$conf{modules}) {
+			if (exists $mod_admin_msgs->{$mod}) {
+				$msg.=$mod_admin_msgs->{$mod};
+			}
+		}
+		$msg .=<<"EOF";
 To get a list of usernames that match IPs, type !regex ips <ips>
 To get a list of IPs that match usernames, type !regex users <usernames>
 To regex search znc.log and output to the terminal, type !regex <regex>
-To delete a shell account, type !shell delete <username>
-To verify a captcha, type !shell captcha <username>
 EOF
 #To get a list of usernames that match IPs, type !shell regex ips <ips>
 #To get a list of IPs that match usernames, type !shell regex users <usernames>