Blame


1 84c190b6 2021-12-17 jrmu #!/usr/bin/perl
2 84c190b6 2021-12-17 jrmu
3 84c190b6 2021-12-17 jrmu package Help;
4 84c190b6 2021-12-17 jrmu
5 84c190b6 2021-12-17 jrmu use strict;
6 84c190b6 2021-12-17 jrmu use warnings;
7 84c190b6 2021-12-17 jrmu use OpenBSD::Pledge;
8 84c190b6 2021-12-17 jrmu use OpenBSD::Unveil;
9 84c190b6 2021-12-17 jrmu
10 84c190b6 2021-12-17 jrmu my %conf = %main::conf;
11 84c190b6 2021-12-17 jrmu my $chans = $conf{chans};
12 84c190b6 2021-12-17 jrmu my $teamchans = $conf{teamchans};
13 84c190b6 2021-12-17 jrmu my @teamchans = split /[,\s]+/m, $teamchans;
14 84c190b6 2021-12-17 jrmu my $staff = $conf{staff};
15 84c190b6 2021-12-17 jrmu my $terms = $conf{terms};
16 84c190b6 2021-12-17 jrmu my $time = "600";
17 84c190b6 2021-12-17 jrmu main::cbind("pub", "-", "help", \&help);
18 84c190b6 2021-12-17 jrmu main::cbind("msg", "-", "help", \&help);
19 84c190b6 2021-12-17 jrmu main::cbind("pub", "-", "request", \&help);
20 84c190b6 2021-12-17 jrmu
21 84c190b6 2021-12-17 jrmu sub init {
22 84c190b6 2021-12-17 jrmu }
23 84c190b6 2021-12-17 jrmu
24 84c190b6 2021-12-17 jrmu sub help {
25 84c190b6 2021-12-17 jrmu my ($bot, $nick, $host, $hand, @args) = @_;
26 84c190b6 2021-12-17 jrmu my ($chan, $text);
27 a58e176a 2023-05-06 jrmu my $mod_msgs= {
28 a58e176a 2023-05-06 jrmu BNC => "To request a free bouncer, type !bnc <username> <email>. For example, !bnc john john\@example.com.",
29 a58e176a 2023-05-06 jrmu Shell => "To request a free shell account, type !shell <username> <email>. For example, !shell john john\@example.com.)",
30 a58e176a 2023-05-06 jrmu Mail => "To request a free email account, type !mail <username> <email>. For example, !mail john john\@example.com.)",
31 a58e176a 2023-05-06 jrmu VPN => "To request a free VPN account, type !vpn <username> <email>. For example, !vpn john john\@example.com.)"
32 a58e176a 2023-05-06 jrmu };
33 a58e176a 2023-05-06 jrmu my $msg = $terms."\n";
34 a58e176a 2023-05-06 jrmu for my $mod (split ' ',$conf{modules}) {
35 a58e176a 2023-05-06 jrmu if (exists $mod_msgs->{$mod}) {
36 a58e176a 2023-05-06 jrmu $msg.=$mod_msgs->{$mod}."\n";
37 a58e176a 2023-05-06 jrmu }
38 a58e176a 2023-05-06 jrmu }
39 a58e176a 2023-05-06 jrmu
40 a58e176a 2023-05-06 jrmu my $mod_admin_msgs={
41 a58e176a 2023-05-06 jrmu BNC => <<"EOF",
42 84c190b6 2021-12-17 jrmu To delete a bouncer, type !bnc delete <username>
43 84c190b6 2021-12-17 jrmu To verify a captcha, type !bnc captcha <username>
44 3a155d60 2023-03-05 jrmu To approve a bouncer, type !bnc approve <username>
45 84c190b6 2021-12-17 jrmu To recreate cloneuser, type !bnc cloneuser
46 a58e176a 2023-05-06 jrmu EOF
47 a58e176a 2023-05-06 jrmu Shell => <<"EOF",
48 a58e176a 2023-05-06 jrmu To delete a shell account, type !shell delete <username>
49 a58e176a 2023-05-06 jrmu To verify a captcha, type !shell captcha <username>
50 a58e176a 2023-05-06 jrmu EOF
51 a58e176a 2023-05-06 jrmu };
52 a58e176a 2023-05-06 jrmu if (main::isstaff($bot, $nick)) {
53 a58e176a 2023-05-06 jrmu for my $mod (split ' ',$conf{modules}) {
54 a58e176a 2023-05-06 jrmu if (exists $mod_admin_msgs->{$mod}) {
55 a58e176a 2023-05-06 jrmu $msg.=$mod_admin_msgs->{$mod};
56 a58e176a 2023-05-06 jrmu }
57 a58e176a 2023-05-06 jrmu }
58 a58e176a 2023-05-06 jrmu $msg .=<<"EOF";
59 84c190b6 2021-12-17 jrmu To get a list of usernames that match IPs, type !regex ips <ips>
60 84c190b6 2021-12-17 jrmu To get a list of IPs that match usernames, type !regex users <usernames>
61 84c190b6 2021-12-17 jrmu To regex search znc.log and output to the terminal, type !regex <regex>
62 84c190b6 2021-12-17 jrmu EOF
63 84c190b6 2021-12-17 jrmu #To get a list of usernames that match IPs, type !shell regex ips <ips>
64 84c190b6 2021-12-17 jrmu #To get a list of IPs that match usernames, type !shell regex users <usernames>
65 84c190b6 2021-12-17 jrmu #To regex search znc.log and output to the terminal, type !shell regex <regex>
66 84c190b6 2021-12-17 jrmu }
67 84c190b6 2021-12-17 jrmu if (@args == 2) {
68 84c190b6 2021-12-17 jrmu ($chan, $text) = ($args[0], $args[1]);
69 84c190b6 2021-12-17 jrmu if ($chans =~ $chan) {
70 84c190b6 2021-12-17 jrmu main::putserv($bot, "PRIVMSG $chan :$nick: Please see private message.");
71 84c190b6 2021-12-17 jrmu }
72 84c190b6 2021-12-17 jrmu } else {
73 84c190b6 2021-12-17 jrmu $text = $args[0];
74 84c190b6 2021-12-17 jrmu }
75 84c190b6 2021-12-17 jrmu main::putserv($bot, "PRIVMSG $nick :$msg");
76 84c190b6 2021-12-17 jrmu foreach my $chan (@teamchans) {
77 792dd662 2023-03-06 jrmu main::putservlocalnet($bot, "PRIVMSG $chan :$staff: Help *$nick* on network ".$bot->{name}.". If you don't help the user, he will probably leave");
78 84c190b6 2021-12-17 jrmu }
79 84c190b6 2021-12-17 jrmu }
80 84c190b6 2021-12-17 jrmu
81 84c190b6 2021-12-17 jrmu 1; # MUST BE LAST STATEMENT IN FILE