Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some simple Perl script snipets for xChat by B22stard
#1
Just place the scripts in the xChat directory and make sure there's the Perl extension ".pl".

Auto ReJoin when kicked:
Code:
#!/usr/bin/perl

my $version = "0.1";
Xchat::register("ReJoin", $version, "Re-join when kicked", "");
Xchat::print("Loaded: Perl AutoReJoin script by B22stard");
Xchat::hook_print("You Kicked", "kicked");

sub kicked {
  my $channel = Xchat::get_info( "channel");
  Xchat::command("j $channel");
  return Xchat::EAT_NONE;
}

Hop script. I wrote this script because there's not "/hop" command for xChat like there is with mIRC. It leaves and rejoins the channel when the command is given.
Code:
#!/usr/bin/perl

my $version = "0.1";
Xchat::register("HopScript", $version, "Leave and Rejoin the channel", "");
Xchat::print('Loaded: Perl Hop script by B22stard. Type "/rejoin" to leave and rejoin the channel.');
Xchat::hook_command("rejoin","rejoin");

sub rejoin {
  my $channel = Xchat::get_info( "channel");
  Xchat::command("part $channel hopping");
  Xchat::command("join $channel");
}

Rhythmbox NowPlaying script. Displays the currently playing song to the channel.
Code:
#!/usr/bin/perl

my $version = "0.3";
Xchat::register("NowPlaying", $version, "Displays currently playing song from Rhythmbox", "");
Xchat::hook_command("np", "nowPlaying");
Xchat::print('Loaded: Perl NowPlaying script by B22stard. Type "/np".');

sub nowPlaying {
    if (`ps -C rhythmbox` =~ /rhythmbox/) {
    $title = `rhythmbox-client --print-playing-format %st`;
    if (length $title > 1) {
        $title = `rhythmbox-client --print-playing-format %st\\ -\\ %tt`;
    } else {
        $title = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
    }
    chop $title;
    Xchat::command("me is listening to: " . $title);
    } else {
    Xchat::print("Rhythmbox is not running.");
    }
}
Reply


Messages In This Thread
Some simple Perl script snipets for xChat by B22stard - by jolttz - 10-08-2009, 10:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compile Error in Perl liveproject101 0 1,208 04-12-2013, 03:08 AM
Last Post: liveproject101
  [Perl] IRC Bot wchar_t 26 13,339 08-20-2012, 01:40 PM
Last Post: Trump
  Perl Ebook ven0m 2 1,691 05-04-2012, 08:14 AM
Last Post: ven0m
  Help with a program written in perl Rodman42866 1 1,586 03-09-2012, 03:16 AM
Last Post: AceInfinity
  HTML perl script AceInfinity 5 2,518 12-03-2011, 11:35 PM
Last Post: Closed Account

Forum Jump:


Users browsing this thread: 1 Guest(s)