searchirc socket for a bot

By PuNkTuReD on Jan 01, 2009

ok so sockets are not my strong point but someone asked for this so i thought id give it a whirl
use in moderation, can lag alot if its trying to msg lots of info

searchirc snippet for a bot

commands:
!searchirc largest
!searchirc letter (letter)
!searchirc network (network)
!searchirc channel (channel)
!searchirc 70000
!searchirc 10000
!searchirc 5000

any suggestions are welcome

/*
!searchirc largest 
!searchirc letter (letter)
!searchirc network (network) 
!searchirc channel (channel) 
!searchirc 70000 
!searchirc 10000 
!searchirc 5000 
*/

on *:text:*:*: {
  if (!searchirc == $strip($1)) {  
    if (largest == $strip($2)) { 
      if ($target == $chan) { set %targ $chan | sockopen searchirclargest searchirc.com 80 }
      if ($target == $me) { set %targ $me | sockopen searchirclargest searchirc.com 80 }
    }
    if (70000 == $strip($2)) { set %targ $chan | sockopen searchirc70000 searchirc.com 80 }
    if (10000 == $strip($2)) { set %targ $chan | sockopen searchirc10000 searchirc.com 80 }
    if (5000 == $strip($2)) { set %targ $chan | sockopen searchirc5000 searchirc.com 80 }
    if (letter == $strip($2)) { set %alpha $3 | set %targ $chan | sockopen searchircletter searchirc.com 80 }
    if (network == $strip($2)) { set %netwrk $3 | set %targ $chan | sockopen searchircnetwork searchirc.com 80 }
    if (channel == $strip($2)) { set %chan1 $3 | set %channel $+(irc-,$3,-1) | set %targ $chan | sockopen searchircchannel searchirc.com 80 }
  }
}
on *:sockopen:searchircchannel: {
  sockwrite -n $sockname GET / $+ %channel HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchircchannel: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (Displaying results isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,,&quot;,) }
    if (/network/ isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,) }
    if (irc:// isin %search) && (Click on the !isin %search) && (using our java !isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,,&quot;,) }
    if (Current isin %search) && (www.billiardsaddict.com !isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,) }
    .timer 1 10 sockclose searchircchannel
  }
}
on *:sockopen:searchircnetwork: {
  sockwrite -n $sockname GET /network/ $+ %netwrk HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchircnetwork: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (currently has isin %search) && (!%waitn) { set -u5 %waitn 1 | msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,) }
    if (Largest 5 channels / users isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,$chr(44)) }
    if (<td width="97%"><p> isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,$chr(44)) }
    if (provided by: isin %search) { msg %targ $replace($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),&nbsp;,$chr(44)) }
    .timer 1 10 sockclose searchircnetwork
  }
}
on *:sockopen:searchircletter: {
  sockwrite -n $sockname GET /network-alpha/ $+ %alpha HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchircletter: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (/network/ isin %search) { 
      set -u5 %a 1
      set -u5 %b 24
      while (%b <= $numtok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),32)) {
        msg %targ $remove($gettok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,), $+ %a $+ - $+ %b $+ ,32),inactive networks have been hidden. To view them, click hereNetworks in)
        set -u5 %a $calc(%a + 24)
        set -u5 %b $calc(%b + 24)
      } 
    }
    .timer 1 10 sockclose searchircletter
  }
}
on *:sockopen:searchirclargest: {
  sockwrite -n $sockname GET /largest-irc-networks HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchirclargest: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (/network/ isin %search) && (representative !isin %search) { 
      set -u5 %a 1
      set -u5 %b 24
      while (%b <= $numtok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),32)) {
        msg %targ $remove($gettok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,), $+ %a $+ - $+ %b $+ ,32),Networks in bold have an active)
        set -u5 %a $calc(%a + 24)
        set -u5 %b $calc(%b + 24)
      } 
    }
    .timer 1 10 sockclose searchirclargest
  }
}
on *:sockopen:searchirc70000: {
  sockwrite -n $sockname GET /network-size/70000 HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchirc70000: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (/network/ isin %search) { 
      set -u5 %a 1
      set -u5 %b 24
      while (%b <= $numtok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),32)) {
        msg %targ $remove($gettok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,), $+ %a $+ - $+ %b $+ ,32),Networks in bold have an active)
        set -u5 %a $calc(%a + 24)
        set -u5 %b $calc(%b + 24)
      } 
    }
    .timer 1 10 sockclose searchirc70000
  }
}
on *:sockopen:searchirc10000: {
  sockwrite -n $sockname GET /network-size/10000 HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchirc10000: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (/rank/ isin %search) { 
      set -u5 %a 1
      set -u5 %b 24
      while (%b <= $numtok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),32)) {
        msg %targ $gettok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,), $+ %a $+ - $+ %b $+ ,32)
        set -u5 %a $calc(%a + 24)
        set -u5 %b $calc(%b + 24)
      } 
    }
    .timer 1 10 sockclose searchirc70000
  }
}
on *:sockopen:searchirc5000: {
  sockwrite -n $sockname GET /network-size/5000 HTTP/1.0 
  sockwrite -n $sockname Host: searchirc.com
  sockwrite -n $sockname $crlf
}
on *:sockread:searchirc5000: {
  if ($sockerr) { echo -a * There was a problem retrieving data from the website. Please try again. }
  else {
    var %search sockread
    sockread %search
    if (/rank/ isin %search) && (representative !isin %search) { 
      set -u5 %a 1
      set -u5 %b 24
      while (%b <= $numtok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,),32)) {
        msg %targ $gettok($regsubex(%search,/^[^<]*>|<[^>]*>|<[^>]*$/g,), $+ %a $+ - $+ %b $+ ,32)
        set -u5 %a $calc(%a + 24)
        set -u5 %b $calc(%b + 24)
      } 
    }
    .timer 1 10 sockclose searchirc5000
  }
}

Comments

Sign in to comment.
PuNkTuReD   -  Jan 01, 2009

u can drop by my server anytime
i only use it for testing scripts

/server -m sassirc.corruptcode.org

 Respond  
Aucun50   -  Jan 01, 2009

Think i need to find a new place to make/test scripts, just got banned LOL.
"i edited it so you can pvt the bot." That could be handy.

 Respond  
PuNkTuReD   -  Jan 01, 2009

lol yea depending on your search, there is alot of info thrown back at ya.
i edited it so you can pvt the bot.

 Respond  
Aucun50   -  Jan 01, 2009

I tested most of them and they works good but i stoped at !searchirc largest because, "#Aucun Message blocked: Promotion and/or advertising of other IRC networks is strictly prohibited. This includes asking others to join another network. WARNING: Do not attempt to bypass this filter last chance."

LOL

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.