tglogo.png

Downloading File

Filename: !Twitter
;Little Twitter Script by Ford_Lawnmower
;This script just parses twitter searches and returns the results. Default is 5 results. You can change this by changing %twitter.max
;Usage: /twitter search words or !twitter search words.
;I'm adding a channel menu item to turn off the trigger.
;Questions & Comments. You can find me on SwiftIRC #Technical,WyldRyde #Script-Help, Mindforge #Technical, Abjects #Technical
alias twitter.timeout {
  if (%twitter.chan != echo) { .msg %twitter.chan Connection was timed out... We could not find your site... :( }
  if (%twitter.chan == echo) { echo -a Connection was timed out... We could not find your site... :( }
  twitter.clear
}
alias twitter.clear {
  unset %twitter*
  sockclose twitter
  .timer-twitter off
  halt
}
alias twitter {
  if (%twitter.inuse == 1) { echo -a twitter in use. To reset the script type /twitter.clear | return error1 | halt }
  set %twitter.inuse 1
  set %twitter.nick $me
  set %twitter.chan ECHO
  sockclose twitter
  set %twitterurl /search?q= $+ $replace($1-,$chr(32),+)
  set %twittersite search.twitter.com
  set %twitter.max 5
  sockopen twitter %twittersite 80
  .timer-twitter 1 15 twitter.timeout
}
#TwitterTrigger on
on *:TEXT:!twitter*:# {
  if (%twitter.inuse == 1) { .notice $nick Sorry, But Somebody else is already searching for a twitter. | halt }
  set %twitter.inuse 1
  set %twitter.nick $nick
  set %twitter.chan $chan
  sockclose twitter
  set %twitterurl /search?q= $+ $replace($2-,$chr(32),+)
  set %twittersite search.twitter.com
  set %twitter.max 5
  sockopen twitter %twittersite 80
  .msg $chan 4 $chan twitter finder... 7Searching4 twitter 3Please Wait.....
  .timer-twitter 1 15 twitter.timeout
}
#TwitterTrigger end
on *:sockopen:twitter: {
  sockwrite -n $sockname GET %twitterurl HTTP/1.1
  sockwrite -n $sockname Host: %twittersite $+ $CRLF $+ $CRLF
}
on *:sockread:twitter: {
  if ($sockerr > 0) { .msg %twitter.chan There has been an error... We could not retrive your Twitter. Sorry |  twitter.clear }
  else {
    var %twittervar |  sockread %twittervar
    if (<div class="msg"> isin %twittervar) { set %twitter.msg on | set %twitter.count $calc(%twitter.count + 1) }
    if (%twitter.msg == on) && (/exit/to/ isin %twittervar) {
      set %twitter.output $httpstrip(%twittervar) 
    }
    if (%twitter.msg == on) && (View Tweet isin %twittervar) {
      if (%twitter.chan == ECHO) { echo -at 07 $+ %twitter.output 06 $+ $gettok($replace(%twittervar,",$chr(7)),2,7) }
      if (%twitter.chan != ECHO) { .timer 1 %twitter.count .msg %twitter.chan 07 $+ %twitter.output 06 $+ $gettok($replace(%twittervar,",$chr(7)),2,7) }
      set %twitter.msg off
    }
    if (No results for isin %twittervar) {
      if (%twitter.chan == ECHO) { echo -at 07Twitter Not Found }
      if (%twitter.chan != ECHO) { .msg %twitter.chan 07Twitter Not Found }
      twitter.clear 
    }
    if (%twitter.count > %twitter.max) { twitter.clear }
    if (SummizeRefresher isin %twittervar) { twitter.clear }
    if (yes isin no) || (on isin off) {
      .msg %twitter.chan 4,1 $httpstrip(%twittervar)
      sockread %twittervar
      twitter.clear
    }
  }
}
;Kirby's menu - Thank You Kirby :)
menu Channel {
  $iif($group(#TwitterTrigger) == On,$style(1)) Twitter
  .$iif($group(#TwitterTrigger) == On,$style(2)) On: .enable #TwitterTrigger
  .$iif($group(#TwitterTrigger) == Off,$style(2)) Off: .disable #TwitterTrigger
}
alias -l httpstrip {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,&quot;)
  return %x
}
 

Related Files


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand