The Twitter Bot reads the latest News of a User.
You don't need to configure anything.
You can change the maximum Post per Data | /set %twitter-reads
Have Fun
Screenshots
alias twitter-connection { sockopen twitter twitter.com 80 }
on *:SOCKOPEN:twitter:{
; connection
sockwrite -n $sockname GET %twitter-connection HTTP/1.1
; Write Connection Details
sockwrite -n $sockname Host: twitter.com
sockwrite -n $sockname User-Agent: IRCSpider/mIRC $version
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:twitter:{
var %mirc.temp 0
sockread %mirc.temp
if (<span class="entry-content"> isin %mirc.temp) {
if ((http://twitter.com/ !isin %mirc.temp) && (tweet-url !isin %mirc.temp) && (%twitter-maxposts != $iif(!%twitter-reads,3,%twitter-reads))) {
msg %twitter-channel 00,02Twitter: ( $+ $remove(%twitter-connection,/) $+ ) $replace($remove(%mirc.temp,<span class="entry-content">,</span>),>,>,<,<,&,&)
inc %twitter-maxposts
}
}
}
on *:SOCKCLOSE:twitter:{ unset %twitter-* }
// [c] janosch_ , don't miss updates @ !twitter <rattazongg> ;)
on *:TEXT:!twitter*:#:{
unset %twitter-maxposts
if (!$2) { msg $chan Syntax: !twitter <username> }
else { set %twitter-connection / $+ $2 | set %twitter-channel $chan | twitter-connection }
}
## PowerScripters for President
Okey :)
However, if you are creating an if statement just to force the else when certain conditions don't exist, you should just use !isin instead of isin and != instead of ==.
Like this:
if ((http://twitter.com/ !isin %mirc.temp) && (tweet-url !isin %mirc.temp) && (%twitter-maxposts != $iif(!%twitter-reads,3,%twitter-reads))) {
msg %twitter-channel 00,02Twitter: ( $+ $remove(%twitter-connection,/) $+ ) $replace($remove(%mirc.temp,<span class="entry-content">,</span>),>,>,<,<,&,&)
inc %twitter-maxposts
}
By the way, you still left the variable %mirc.temp set. If you don't declare the variable as local before you sockread to it, it's automatically declared as global.
This is the proper way to do it with a local variable.
var %mirc.temp | sockread %mirc.temp
@FordLawnmower:
Fixed all of those. - Sure, i want to use POST first, to insert Twitter-Posts, but after that i decided to use GET, but i forget to change the COnnection Details.
/noop is just for no-operation, replaced it now with /unset %twitter-*
The empty brackets are now for /noop | the same ... - it works so, and thats fine. :o
Forgive Me, I uploaded that ugly Code, thanks for your Command. :)
What on earth is all of this for?
; connection
sockwrite -n $sockname GET %twitter-connection HTTP/1.1
; Write Connection Details
sockwrite -n $sockname Host: twitter.com
sockwrite -n $sockname User-Agent: IRCSpider/mIRC $version
sockwrite -n $sockname Accept: *.*, */*
sockwrite -n $sockname Referer: $server
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Content-Type: text/html
sockwrite -n $sockname $crlf
On occasion you may need User Agent:, Referer: is never needed, Content-Type: is for POST not GET as is Accept:, and Connection: is not needed here.
All that is needed here is Host: and GET the rest is just slowing down the script.
; connection
sockwrite -n $sockname GET %twitter-connection HTTP/1.1
sockwrite -n $sockname Host: twitter.com
sockwrite -n $sockname $crlf
Also, did you realize that you pointed an if at empty brackets { }
if ((http://twitter.com/ isin %mirc.temp) || (tweet-url isin %mirc.temp) || (%t = $iif(%twitter.reads == $null,3,%twitter.reads))) { }
What is the point of this?
on *:SOCKCLOSE:twitter:{ /noop }
You didn't unset your variables either.
Sorry if it seems like I'm ranting on your script, I'm sure you worked hard on it, please forgive me :((
I'll stop now because I see several other things.