Advertisement
swarley

Aways.pl

Jan 29th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.67 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use Xchat ':all';
  4.  
  5. Xchat:::hook_command('aways', 'aways');
  6.  
  7. sub aways {
  8.    my $buffer = 'I\'m going to listen to Music                ((((((((IN-DOLBY-SURROUND-SOUND-AS-I-FALL-ASLEEP))))))))               - Time: ';
  9.    my $time   = '';
  10.    my @local  = localtime(time);
  11.    my($hours,$suffix);
  12.    $hours = $local[2];
  13.    if($hours > 12) {
  14.       $hours -= 12;
  15.       $suffix = 'pm';
  16.    }
  17.    elsif( $hours == 0) {
  18.       $hours  = 12;
  19.       $suffix = 'am';
  20.    }
  21.    else {
  22.       $suffix = 'am';
  23.    }
  24.    $buffer .= $hours . ':' . $local[1] . ':' . $local[0] . $suffix;
  25.    Xchat::command('AWAY ' . $buffer);
  26.    Xchat::command('NICK ' . Xchat::get_info('nick') . '|sleep');
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement