Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.01 KB | None | 0 0
  1. if ($msg =~ /^\!blueplz/) {
  2.    if ($irc->is_channel_operator($channel, $nick)) {
  3.           $irc->yield(notice => $nick => 'Preshow countdown started for 19 GMT');
  4.           &heartbeat;
  5.      } else {
  6.          $irc->yield(kick => $channel => $nick => 'Do not try to use operator commands.');
  7.          }
  8.   }
  9.  
  10. if ($msg =~ /^\!cancelbp/) {
  11.    if ($irc->is_channel_operator($channel, $nick)) {
  12.           $irc->yield(notice => $nick => 'Preshow countdown cancelled');
  13.                  $_[KERNEL]->alarm_remove_all();
  14.      } else {
  15.          $irc->yield(kick => $channel => $nick => 'Do not try to use operator commands.');
  16.          }
  17.   }
  18.  
  19.  
  20. }
  21.  
  22. sub heartbeat {
  23.     $_[KERNEL]->delay(heartbeat => 15);
  24.     &blueplz;
  25. }
  26.  
  27.  
  28. sub blueplz {
  29.    $topicinfo = $irc->channel_topic($channel);
  30.    $topic = $topicinfo->{Value};
  31.    my $gmt = 'true';
  32.  
  33.    my ($cyear,$cmonth,$cday, $chour,$cmin,$csec) = Today_and_Now($gmt);
  34.    my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($cyear,$cmonth,$cday, $chour,$cmin,$csec, $cyear,$cmonth,$cday, $showtime,'0','0');
  35.    if ($Dh == '0') {
  36.      if ($Dm != $oldtime) {
  37.              if ($Dm =~ /.0/) {
  38.                  if ($topic =~ m/Blue Plz Preshow starts in/i) {
  39.                      if ($Dm <= '10') {
  40.                                  $topic =~ s/\| Blue Plz Preshow starts in \d+ (minutes|hours) \|/\| Blue Plz Preshow starts in $Dm minutes \|/;
  41.                                  $irc->yield(topic => $channel => $topic);
  42.                                  print 'Blue Plz in 10 minutes, Timer deactivated\n';
  43.                                  $_[KERNEL]->alarm_remove_all();
  44.                                  } else {
  45.                                  $topic =~ s/\| Blue Plz Preshow starts in \d+ (minutes|hours) \|/\| Blue Plz Preshow starts in $Dm minutes \|/;
  46.                                  $irc->yield(topic => $channel => $topic);
  47.                                  $oldtime = $Dm;
  48.                                  }
  49.                                 } else {
  50.                                 $newtopic = '' . $topic . ' | Blue Plz Preshow starts in ' . $Dm . ' minutes |';
  51.                                 $irc->yield(topic => $channel => $newtopic);
  52.                                 $oldtime = $Dm;
  53. }
  54.                                  }
  55.          }
  56.          } else {
  57.          if ($Dh != $oldtime--) {
  58.              if ($topic =~ m/Blue Plz Preshow starts in/i) {
  59.                                 $hour = $Dh++;
  60.                                 $topic =~ s/\| Blue Plz Preshow starts in \d+ hours \|/\| Blue Plz Preshow starts in $hour hours \|/;
  61.                                 $irc->yield(topic => $channel => $topic);
  62.                                 $oldtime = $Dh;
  63.                          } else {
  64.                                 $hour = $Dh++;
  65.                                 $newtopic = '' . $topic . ' | Blue Plz Preshow starts in ' . $hour . ' hours |';
  66.                                 $irc->yield(topic => $channel => $newtopic);
  67.                                 $oldtime = $Dh;
  68.                          }
  69.   }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement