Add role/everyone ping option

This commit is contained in:
ngoomie 2023-04-06 18:05:28 -06:00
parent 95653fc755
commit 82b628d0b5
2 changed files with 12 additions and 0 deletions

2
.gitignore vendored
View File

@ -50,3 +50,5 @@ inc/
/pm_to_blib /pm_to_blib
/*.zip /*.zip
# SQLite
*.sqlite

10
main.pl
View File

@ -7,6 +7,9 @@ use DBI;
# Config # Config
my $url = 'paste webhook URL here'; my $url = 'paste webhook URL here';
my $rolePing = 0; # 0 = don't ping at all, 1 = ping role ID specified in $roleID, 2 = everyone
my $roleID = 0;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my @month_name = qw(January February March April May June July August September October November December); my @month_name = qw(January February March April May June July August September October November December);
$year += 1900; $year += 1900;
@ -40,6 +43,13 @@ else {
'color' => rand 16777215 'color' => rand 16777215
}); });
if ($rolePing > 0) {
if ($rolePing == 1) {
$webhook->execute( content => '<@&' . $roleID . '>' );
} elsif ($rolePing == 2) {
$webhook->execute( content => '@everyone' );
}};
if ($#questions == 0) { if ($#questions == 0) {
$webhook->execute( content => '**You\'re out of questions!** Please add more or no question will be posted tomorrow.'); $webhook->execute( content => '**You\'re out of questions!** Please add more or no question will be posted tomorrow.');
$dbh->disconnect; warn "Last available question used, finished" $dbh->disconnect; warn "Last available question used, finished"