Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($msg =~ /^\!blueplz/) {
- if ($irc->is_channel_operator($channel, $nick)) {
- $irc->yield(notice => $nick => 'Preshow countdown started for 19 GMT');
- &heartbeat;
- } else {
- $irc->yield(kick => $channel => $nick => 'Do not try to use operator commands.');
- }
- }
- if ($msg =~ /^\!cancelbp/) {
- if ($irc->is_channel_operator($channel, $nick)) {
- $irc->yield(notice => $nick => 'Preshow countdown cancelled');
- $_[KERNEL]->alarm_remove_all();
- } else {
- $irc->yield(kick => $channel => $nick => 'Do not try to use operator commands.');
- }
- }
- }
- sub heartbeat {
- $_[KERNEL]->delay(heartbeat => 15);
- &blueplz;
- }
- sub blueplz {
- $topicinfo = $irc->channel_topic($channel);
- $topic = $topicinfo->{Value};
- my $gmt = 'true';
- my ($cyear,$cmonth,$cday, $chour,$cmin,$csec) = Today_and_Now($gmt);
- my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($cyear,$cmonth,$cday, $chour,$cmin,$csec, $cyear,$cmonth,$cday, $showtime,'0','0');
- if ($Dh == '0') {
- if ($Dm != $oldtime) {
- if ($Dm =~ /.0/) {
- if ($topic =~ m/Blue Plz Preshow starts in/i) {
- if ($Dm <= '10') {
- $topic =~ s/\| Blue Plz Preshow starts in \d+ (minutes|hours) \|/\| Blue Plz Preshow starts in $Dm minutes \|/;
- $irc->yield(topic => $channel => $topic);
- print 'Blue Plz in 10 minutes, Timer deactivated\n';
- $_[KERNEL]->alarm_remove_all();
- } else {
- $topic =~ s/\| Blue Plz Preshow starts in \d+ (minutes|hours) \|/\| Blue Plz Preshow starts in $Dm minutes \|/;
- $irc->yield(topic => $channel => $topic);
- $oldtime = $Dm;
- }
- } else {
- $newtopic = '' . $topic . ' | Blue Plz Preshow starts in ' . $Dm . ' minutes |';
- $irc->yield(topic => $channel => $newtopic);
- $oldtime = $Dm;
- }
- }
- }
- } else {
- if ($Dh != $oldtime--) {
- if ($topic =~ m/Blue Plz Preshow starts in/i) {
- $hour = $Dh++;
- $topic =~ s/\| Blue Plz Preshow starts in \d+ hours \|/\| Blue Plz Preshow starts in $hour hours \|/;
- $irc->yield(topic => $channel => $topic);
- $oldtime = $Dh;
- } else {
- $hour = $Dh++;
- $newtopic = '' . $topic . ' | Blue Plz Preshow starts in ' . $hour . ' hours |';
- $irc->yield(topic => $channel => $newtopic);
- $oldtime = $Dh;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement