Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.63 KB | None | 0 0
  1. #Onpublic Trigger
  2. if (my ($showtime = $msg =~ /^\!blueplz (.+)/) {
  3.    if ($irc->is_channel_operator($channel, $nick)) {
  4.       $irc->yield(privmsg => $channel => '' . $nick . 'has activated blue plz timer, once it works');
  5.       $irc->yield(notice => $nick => 'Countdown started for ' . $showtime . ' GMT');
  6.       blueplz($showtime);
  7.    }
  8.  
  9. #Subroutine
  10. sub blueplz {
  11.    my $showtime=shift;
  12.    my $gmt = 'true';
  13.    my ($cyear,$cmonth,$cday, $chour,$cmin,$csec) = Today_and_Now([$gmt]);
  14.    my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($cyear,$cmonth,$cday, $chour,$cmin,$csec, $cyear,$cmonth,$cday, $showtime,'0','0');
  15.    if ($Dh == '0') {
  16.       if ($Dm =~ /.{1}0/) {
  17.       if ($oldtime != $Dm) {
  18.          if ($Dm =< '10'){
  19.             my $topic = $irc->channel_topic($channel);
  20.             $topic = s/\| Blue Plz Preshow starts in .* \|/\| Blue Plz Preshow starts in $Dm minutes/;
  21.             $irc->yield(topic => '#cynicalbrit' => $topic);
  22.          } else {
  23.             my $topic = $irc->channel_topic($channel);
  24.             $topic = s/\| Blue Plz Preshow starts in .* \|/\| Blue Plz Preshow starts in $Dm hours/;
  25.             $irc->yield(topic => '#cynicalbrit' => $topic);
  26.             my $oldtime = $Dm;
  27.             sleep(15);
  28.             blueplz($showtime);
  29.          }  
  30.    } else {
  31.    if ($oldtime != $Dh) {
  32.             $hour = $Dh++;
  33.             my $topic = $irc->channel_topic($channel);
  34.             $topic = s/\| Blue Plz Preshow starts in .* \|/\| Blue Plz Preshow starts in $hour hours/;
  35.             $irc->yield(topic => '#cynicalbrit' => $topic);
  36.             my $oldtime = $Dh;
  37.             sleep(15);
  38.             blueplz($showtime);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement