Ok so i’ve been working on a bot and have branched off a little bit and made an RSS bot. It’s pretty basic but it does what it says on the tin.

#!/usr/bin/perl
#__ ___ _____ _ _
#\ \ / (_) / ___| | (_)
# \ V / _ ______\ `–.| |__ _
# / \| |______|`–. \ ‘_ \| |
#/ /^\ \ | /\__/ / | | | |
#\/ \/_| \____/|_| |_|_|BOT[RSS Version] Created By Emery
#

use IO::Socket::INET ;
use LWP::UserAgent;
use LWP::Simple;
use XML::Simple;

##Bot Configuration
my $server = “irc.evilzone.org”;
my $port = “6667”;
my $nick =”bawt”;
my $name = “nix user alpha unr”;
my $channel = “#test”;

system(‘cls’);
print “\n [+] Connection To $server ….\n”;

##Server Connection
$connection = IO::Socket::INET->new(PeerAddr=>”$server”,
PeerPort=>”$port”,
Proto=>’tcp’,
Timeout=>’30’) or print ” [!] Couldnt Connect To $server\n”;
print ” [+] Connected To $server ….\n\n”;

##Authentication
print $connection “USER $name\n”;
print $connection “NICK $nick\r\n”;

##Commands
while($response = <$connection>)
{
##IRC Screen
print $response;

##Join Channel
if($response =~ m/:(.*) 00(.*) (.*) :/)
{
print $connection “JOIN $channel\r\n”;
}

##Bot commands
if($response =~ m/:!Feeds/)
{
print $connection “PRIVMSG $channel : —————-== RSS Feeds ==—————\r\n”;
print $connection “PRIVMSG $channel : BBC RSS Feed => : !bbc-tech \r\n”;
print $connection “PRIVMSG $channel : Some RSS Feed => : !rss \r\n”;
}

#——————– RSS FEEDS ——————

##BBC Tech News
if ($response =~m/:!bbc-tech/)
{
my $rss = get(‘http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml&#8217;);
my $xml = XMLin($rss);
my $spl = scalar(@{$xml->{channel}->{item}});
for ($i=0; $i<$spl; $i++) { print $connection “PRIVMSG $channel :\n”; print $connection “PRIVMSG $channel :Date : $xml->{channel}->{item}->[$i]->{pubDate}\n”;
print $connection “PRIVMSG $channel :Title: $xml->{channel}->{item}->[$i]->{title}\n”;
print $connection “PRIVMSG $channel :Link : $xml->{channel}->{item}->[$i]->{link}\n\n”;
};
}

Leave a comment