Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.77 KB | None | 0 0
  1. use Irssi;
  2. use strict;
  3. use vars qw($VERSION %IRSSI);
  4.  
  5. $VERSION = "1.00";
  6. %IRSSI = (
  7.     authors => 'igogiko',
  8.     name => 'lastfmnp',
  9.     description => 'Displays current last.fm np for nick.',
  10.     license => 'tapan sut',
  11.     changed     => 'EI VITTU IKINA' );
  12.  
  13. sub lastfm {
  14.     my ($nick, $server, $chan) = @_;
  15.     my $yournick = "igogiko-YUP";
  16.  
  17.     if(!$server || !$server->{connected}) {
  18.         Irssi::print("Not connected to server");
  19.         return;
  20.     }
  21.  
  22.     my $output = `python ~/.irssi/scripts/lastfm.py $yournick`;
  23.     $output =~ s/\s+$//;
  24.  
  25.     if($chan && ($chan->{type} eq "CHANNEL" ||
  26.                 $chan->{type} eq "QUERY")) {
  27.  
  28.         $server->command("MSG ".$chan->{name}." np: $output");
  29.  
  30.     }
  31. }
  32.  
  33. Irssi::command_bind ('np', 'lastfm');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement