mIRC Home    About    Download    Register    News    Help

Print Thread
#212854 07/06/09 03:47 AM
P
partyboy911
partyboy911
P
Hello Everyone,

So there has been a lot of buzz on twitter, and I realized it would be cool if I could have my mIRC bot post my twitter status everytime it is updated. Or at least when typing say !twitter, it pulls up my twitter.

I have found a lot of scripts on how to update twitter from mIRC, but not for it to post the twitter status when updated from twitter.

Does anyone have any ideas?

Cheers,
Dylan

#212862 07/06/09 06:15 PM
S
state
state
S
ppl who use twitter need to get a serious life. Hope this helps

#212904 08/06/09 06:48 PM
P
partyboy911
partyboy911
P
Originally Posted By: state
ppl who use twitter need to get a serious life. Hope this helps


No, it does not.

#212908 08/06/09 08:56 PM
E
Excalibur
Excalibur
E
There's one on mIRCscripts.org, could be in the file queue still.

#213018 14/06/09 06:01 PM
P
partyboy911
partyboy911
P
Originally Posted By: Excalibur
There's one on mIRCscripts.org, could be in the file queue still.


Thanks.. but I don't think that will work. The only one I see is "Twitter Update & Direct Message" which is for sending updates. Not receiving.

Thanks anyway though smile

#213019 14/06/09 07:01 PM
P
PowerMX
PowerMX
P
Maybe this will help you...

Code:
alias tweet {
  set %tw.username YOURLOGIN
  set %tw.password YOURPASSWD
  if ($len($1-) > 140) {
    echo -a Ops, that was $calc($len($1-)-140) ONLY 140 Chars!
    halt
  }
  set %authentication $encode($+(%tw.username,:,%tw.password),m)
  sockclose twitter
  sockopen twitter twitter.com 80
  .timertwitter 1 10 twitter_timeout
  set %tweet $$1-
}

alias urlencode return $regsubex($1-,/\G(.)/g,$iif(($prop && \1 !isalnum) || !$prop,$chr(37) $+ $base($asc(\1),10,16),\1))
alias urldecode return $replace($regsubex($1-,/%(\w\w)/g,$chr($iif($base(\t,16,10) != 32,$v1,1))),$chr(1),$chr(32))

on *:sockopen:twitter:{
  sockwrite -n twitter POST /statuses/update.json HTTP/1.1
  sockwrite -n twitter Host: twitter.com
  sockwrite -n twitter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
  sockwrite -n twitter Content-Length: $calc($len($urlencode(%tweet)) + 9)
  sockwrite -n twitter Authorization: Basic %authentication
  sockwrite -n twitter $crlf
  sockwrite twitter status=
  sockwrite -n twitter $urlencode(%tweet)
  sockwrite twitter $crlf
  sockwrite twitter $crlf
}


alias twitter_timeout {
  echo -a Message Failed to Send - Socket Timeout 
  sockclose twitter
}


on *:sockread:twitter: {
  .timertwitter off
  sockread -f %string
  echo -a Message Status ( $+ %string $+ )
  sockclose twitter
}

menu channel {
  Twitter
  .Send Tweet { /tweet $?="Mensaje:" }
}

on *:text:!twitter*:#channel:{
  /tweet Message from $nick : $2-
}



Cheers.

#213027 15/06/09 01:34 AM
B
borgx
borgx
B
partyboy911,

I do not have a script for you, but for a trigger you can pull the last tweet of a user by fetching "http://search.twitter.com/search?rpp=1&from=<username>" and then filter the results from the html. The results are in a li element with a class of "result ". The actual message part is in a div element with a class of "msg".

-edit-

I did notice a similar script to my post on hawkee. With a little modification it can do what you want (at least the trigger part).
http://www.hawkee.com/snippet/5883/

Last edited by borgx; 15/06/09 01:37 AM.
#213038 15/06/09 08:08 PM
R
RichardBlank
RichardBlank
R
solid information. Thanks.


Richard



.

#213094 17/06/09 05:19 PM
Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Here's one I wrote a while ago...

Code:
alias -l username return <your username>
alias -l password return <your password>

alias -l raiseerror {
  echo -a * /twitter: $1-
  halt
}
alias -l urlencode return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))

alias twitter {
  hfree -w twitter
  sockclose twitter
  sockopen twitter twitter.com 80
  sockmark twitter status= $+ $urlencode($1-)
}

on *:sockopen:twitter:{
  if ($sockerr) {
    sockclose twitter
    raiseerror socket error. Try again later.
  }
  var %s = sockwrite -n twitter
  %s POST /statuses/update.xml HTTP/1.1
  %s Host: twitter.com
  %s Authorization: Basic $encode($+($username,:,$password),m)
  %s Accept: */*, *.*
  %s Connection: close
  %s User-Agent: mIRC/ $+ $version
  %s Content-Type: application/x-www-form-urlencoded
  %s Content-Length: $len($sock(twitter).mark)
  %s
  %s $sock(twitter).mark
}
on *:sockread:twitter:{
  var %data
  sockread %data
  if ($regex(%data,/<error>(.+?)</error>/)) {
    hfree -w twitter
    sockclose twitter
    raiseerror $regml(1)
  }
  if ($regex(%data,/<(.+?)>(.+?)</\1>/)) hadd -m twitter $regml(1) $regml(2)
  elseif (%data == </status>) .signal twitterpost
}


Edit the username and password return values at the top, then use /twitter <status> to update your status.

When the post is complete you can use the "twitterpost" signal to do something, like so:

Code:
on *:signal:twitterpost:{
  var %i = 1
  while ($hget(twitter,%i).item) {
    echo -a $v1 : $hget(twitter,$v1)
    inc %i
  }
}


Link Copied to Clipboard