This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Birdy (OAuth, Twitter, Tweets&MegaHAL v6.01d) Jun12,2013

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Birdy (OAuth, Twitter, Tweets&MegaHAL v6.01d) Jun12,2013

Post by speechles »

Image

As of May, 24th 2011, this script will be known as simply, birdy. It's old name left within parenthesis for legacy purposes.

Latest version avaiilable here: Birdy (OAuth, Twitter, Tweets with Megahal) v6.01d (Egghelp version)
Note: Read through this thread if you need documentation as this thread is all that exists... ;)
---
Twitter v3.0 is now available. Those reading the scripting help forum may have noticed a "twitter" thread where I gave out a script which read twitter status and tweets from an account. This was merely part 1 of a 2 part process. The addition is now you have an ability to tweet as well from IRC. This integrates twitter fully as an IRC presence.

Code: Select all

# This is the twitter logo.
set twitter(logo) "\[\002\00311Twitter\002\003]:"

# Set user agent.
set twitter(agent) "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"

# Set the url base
set twitter(url) "http://twitter.com/"

# Set the output style here:
# %chan == $chan, %nick == $nick
# no other variables can be used
set twitter(output) "PRIVMSG %chan"

# What effect would you like added to twitter numerics?
# for example:
# effect on "\00304" is red text
# effect off "\003" turns off the color
set twitter(effect-on) "\002"
set twitter(effect-off) "\002"

# how many seconds should each user wait before re-issuing
# a twitter command? Set this in seconds.
set twitter(throttle) 1

# If you have Trf or zlib packages detectable, this script
# will let you use gzip to speed up your twittering..
# Would you like to enable gzip auto-detection?
set twitter(use_gzip) 1

# Url to issue tweets to
set twitter(tweet) "http://twitter.com/statuses/update.json?"

# Set tweet format here
# %nick = $nick
# %chan = $chan
# %text = user input
set twitter(tweetformat) "<%nick> %text"

# minimum flags required to issue tweets
set twitter(flags) "vomn|vomn"

# what modes can people temporarily tweet with
# these are channel modes, not flags on the bot
# you can use op, voice, or both, or "".
set twitter(channel) [list "op" "voice"]

# Accts to tweet to
# "#channel|Login|Password"
set twitter(accts) {
 "#yourchan|youracct|yourpass"
 "#your2ndchan|your2ndacct|your2ndpass"
 "#yourmirrorchan|youracct|yourpass"
}
Now before you get too excited this does come with some extra requirements. In order to be able to !tweet you MUST somehow provide the 2 packages below: After these 2 requirements are met. There are some optional requirements:
  • Gzip (provided via Trf or zlib packages) - speed up web fetches
    --> Eggdrop use Trf package
    --> Windrop use precompied zlib package (tcl8.6 compatible)

    Http package 2.5 - support utf-8 properly
    --> Eggdrop and windrop platform independent
    Without http package 2.5 present, the script will not be able to make true UTF-8 queries. This may or may not cause problems for english speaking users, but for anyone else this will cause serious issues.

    Utf-8 patch - support proper utf-8 encodings for both input/output
    --> Eggdrop --> http://forum.egghelp.org/viewtopic.php?t=13932&start=3
    --> Windrop --> ?? .. my only suggestion is installing cygwin and follow the eggdrop advice
<speechles> !tweet Hello http://forum.egghelp.org users ;)
<sp33chy> [Twitter]: Tweet created: [#roms-isos@SuqMuhNutz via API] Sun Jan 31 19:16:59 +0000 2010

<speechles> !twitter suqmuhnutz
<sp33chy> [Twitter]: Getting Status For: suqmuhnutz...
<sp33chy> [Twitter]: Name: #roms-isos; location: Eris Free Net (#efnet), IRC; Following: 0; Followers: 1; Listed: 0; Total Tweets: 4.
<sp33chy> [Twitter]: Last Tweet: [less than 20 seconds ago] <speechles> Hello ( http://forum.egghelp.org ) users ;)
<sp33chy> [Twitter]: http://twitter.com/suqmuhnutz [Region: en] [Gzip]
Get the script here: Twitter & Tweets v3.0
... and as always, any and all questions, comments, bugs, problems.. Post them accordingly to this thread and let's solve them..

Latest Download: Twitter & Tweets v3.3
Last edited by speechles on Wed Jun 12, 2013 6:43 am, edited 39 times in total.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Can you please specify where exactly and what is the correct format for changing the details to my own twitter username for the updates?

# Url to issue tweets to
set twitter(tweet) "http://twitter.com/statuses/update.json?"

# "#channel|Login|Password"
set twitter(accts) {
#"#your2ndchan|your2ndacct|your2ndpass"
#"#yourmirrorchan|youracct|yourpass"

Are these the only sections I need to change and if so can you please give an example of a correct format?

Because it doesn't work for me;

[21:28:55] <@EPL> [11Twitter]: Cannot find an account to tweet for #EPL. Failed.
Idling at #Football, Quakenet.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Football wrote:Can you please specify where exactly and what is the correct format for changing the details to my own twitter username for the updates?

# Url to issue tweets to
set twitter(tweet) "http://twitter.com/statuses/update.json?"

# "#channel|Login|Password"
set twitter(accts) {
#"#your2ndchan|your2ndacct|your2ndpass"
#"#yourmirrorchan|youracct|yourpass"

Are these the only sections I need to change and if so can you please give an example of a correct format?

Because it doesn't work for me;

[21:28:55] <@EPL> [11Twitter]: Cannot find an account to tweet for #EPL. Failed.
I'll make it very easy to understand. To create an account for #EPL using the username "ME" and password "PASS" would be done like this:

Code: Select all

set twitter(accts) {
 "#epl|ME|PASS"
}
**Note: The rule here is twitter accounts must ALWAYS use lowercase channel names when matching. Don't worry the actual case of your channel is irrelevant and will be treated correctly. But when crafting your accounts list this rule must be adhered to.

Now suppose you also have an @ops channel for #EPL channel and it's called #EPL-ops. You want this @ops channel to post to the same account for tweets.

Code: Select all

set twitter(accts) {
 "#epl|ME|PASS"
 "#epl-ops|ME|PASS"
}
This is how easy it is to add accounts for your channels. Add as many or as little as you like.

Now your wondering, great everything works, but just "how do I tell which channel the users are in when they tweet?" This is where you would need to tailor yourself a custom "tweetformat" such as making the change below:

Code: Select all

# changing this
set twitter(tweetformat) "<%nick> %text"

# to this
# channel is added after nick with an @, penalty is average 10-25 character loss of 140 limit.
set twitter(tweetformat) "<%nick@%chan> %text

# or this
# channel is prefixed, nick is given, same penalty as using above. Math is equal.
set twitter(tweetformat) "%chan <$nick> %text"

# or this
# nick is prefixed, channel is lost in favor of text if truncation occurs. Less of a penalty as above as channel is appended. Approximately 6-13 characters lost of the 140 limit.
set twitter(tweetformat) "<%nick> %text (%chan)"

# or this - full 140 for the user, no way to tell who or where said what
# just what was said no very useful except as a personal irc blog setting
# flags to allow only the owner +n of the bot and that being yourself.
set twitter(tweetformat) "%text"
When expanded tweets (which means counting everything before %text) you must take into account that the characters < and > together equal 2. Then the length of the nickname plus the length of the channel are added. This amounts to (2 + length of nick + 1 (the @) + length of channel + 1 (the space between)) for where we start into the 140 characters. This 140 characters is a limit imposed by twitter and set in stone no way to change. So if your seeing your messages truncated, you probably were told this when the tweet was issued but weren't looking close enough. The bot does tell you when it's truncating your messages. You may need to adjust your tweet format if at all possible. If you put your messages after %text you run the risk of these being truncated or cut off in favor of the users text. What method you decided to use is yours.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Thanks a lot speechless, seems that my only mistake was the lowercase sensitive issue, I fixed it and it works perfectly now!

I was wondering if there's any chance for a future script that will expand the current one, where the script will update friend's tweet & direct messages and output them to mIRC?

maybe even a !follow button that will allow you to add people you want to follow.
Idling at #Football, Quakenet.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Football wrote:Thanks a lot speechless, seems that my only mistake was the lowercase sensitive issue, I fixed it and it works perfectly now!

I was wondering if there's any chance for a future script that will expand the current one, where the script will update friend's tweet & direct messages and output them to mIRC?

maybe even a !follow button that will allow you to add people you want to follow.
Not sure if I quite follow what you mean? But I do have a new version, which includes globalized and local tweet formats. Now each of your channels can be customized entirely. Or you can just omit them locally and the global format will over ride.

Code: Select all

# Set the global tweet format here
# if no local tweet format is set in the channel acct list below
# then the global setting will be used instead.
# %nick = $nick
# %chan = $chan
# %text = user input
# %modes = (+, @, +@) only op, voice or both presently...
set twitter(globaltweetformat) "<%modes%nick> %text"

...snip...

set twitter(accts) {
 "#yourchan|youracct|yourpass"
 "#yourchan-ops|youracct|yourpass|<<%modes%nick>> %text"
 "#yourotherchan|your2ndacct|your2ndpass|<%modes%nick@%chan> %text"
 "#yourotherchan-ops|your2ndacct|your2ndpass|<<%modes%nick>> %text"
}
Notice the addition of %modes as a tweet-format variable. This could be "+" "@" or "+@" signifying voice, op, or both. Not really that big of a deal, but makes way for further expansion I've already got in mind, which is as follows:

Code: Select all

# to do:
# 1) instead of just showing the last tweet, allow searching by
# tokens and build a list of search results so a user can browse
# their or others tweets within the twitter account. this will
# work in a fashion similar, if not exactly, as using a !quote
# database is for users on irc.
# 2) mask support for globalized tweets within any channel
# allowing a user using the masks supporting this to
# !tweet from any channel the bot uses and have those tweets
# not go to the local channel's account pool, but instead
# to their own personal twitter, perhaps a -me flag or
# something similar...
# 3) use more features of the json rest api then just
# using it to tweet. it can do alot more than this. tweeting
# is just scratching the surface. this will depend on what
# users of this script (you the public) decide and your
# comments on egghelp will decide which features from the
# api you most frequently would use..
# 4) ???
If you can make your request clearer and provide some clear examples of what you mean it's quite possible it's attainable.

Note: Twitter uses the @ sign to signify twitter accountholders. This might cause !twitter replies to give links to accounts which do not belong to the nickname they appear to be attached to (when !tweet is used by @ops and your tweet-format is using %modes). This will be corrected shortly, and an option given to suppress twitter syntax expansion if it's found to be bound by < >'s. Version 3.2 comin' up soon... stay tuned..
Last edited by speechles on Sun Feb 07, 2010 11:46 am, edited 1 time in total.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

I`ll explain.

At the moment you can tweet (update your status) through mIRC right?
And while when you're using twitter.com, when someone you follow tweets, you can see it, so I was saying how about if the script will also update tweets that come from people you are following (your account)

Example:

(Tweet from twitter.com, someone I`m following)

McAllyn: So far, I appear to have only gotten one blister. about one less than I expected.
about 12 hours ago from web

<@EPL> New Tweet (McAllyn): "So far, I appear to have only gotten one blister. about one less than I expected."

And my second suggestion was a trigger that will allow you to add users/accounts to you 'follow list'

!follow McAllyn
<EPL> I will follow McAllyn from now on.

And of course if someone sends your twitter account a direct message, you will recieve it in mIRC

<EPL> New direct message recieved by Koko

Or something like that.. just throwing some suggestions..

By the way, I`m trying to contact you on EFnet, but you keep ignoring my messages.. (using the nick Xabriel)
Idling at #Football, Quakenet.
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

!follow McAllyn
<EPL> I will follow McAllyn from now on.

And of course if someone sends your twitter account a direct message, you will recieve it in mIRC


Twitter uses rss, why not get rss-synd.tcl and add them yourself?

EDIT: I just checked out the following tweets and well, it requires a user/pass in rss feeds I'm guessing you could so something like: "https://user:pass@twitter.com/statuses/ ... meline.rss" which would use one feed and post who you are following tweets.

Not sure how the login is gonna work tho.


Edit:

http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1225 doesn't work only returns html code. -_-
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

This works:

Code: Select all

	set rss(twitter) {
		"url"			"https://user:pass@twitter.com/statuses/friends_timeline.rss"
		"channels"		"#xboxrocks"
		"database"		"./scripts/twitter.db"
		"output"		"[\002Twitter\002] User: @@item!title@@ - Tweet: @@item!link@@"
		"trigger"		"!trss"
	}
I was using it on another server where I didn't have tls installed so it disabled it no wonder, get rss-synd.tcl from egghelp archive and add that to it and replace user with your user and pass witht your pass. :)
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

I added that to my rssnews.tcl script, it does not read it.
(Of course I modified the link to my username & password)

i.e

https://EPL_Quakenet:mypasswordhere@twi ... meline.rss
Idling at #Football, Quakenet.
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Have you checked it? it didn't work for me with either scripts.

[10:41] RSS HTTP Error: https://twitter.com/statuses/friends_timeline.rss (HTTP/1.1 401 Unauthorized)
Idling at #Football, Quakenet.
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

Football wrote:Have you checked it? it didn't work for me with either scripts.

[10:41] RSS HTTP Error: https://twitter.com/statuses/friends_timeline.rss (HTTP/1.1 401 Unauthorized)
Yes I have: replace the user with user then pass with pass leave the : between user/pass and leave @. :)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Here's a new beta version for everyone to try out. Expands upon the original idea, and along with !tweet and !twitter you now have a few more commands.
<speechles> !myfriends
<sp33chy> [Twitter]: [1-4] Friends timelines (#roms-isos@suqmuhnutz):
<sp33chy> (1/20) [8784484160 @ Sun Feb 07 23:39:59 +0000 2010] (#roms-isos@suqmuhnutz) (API): <speechles> * superGear (supergear@my.barbie.wears.no-panties.org) is now known as buttcrustjones
<sp33chy> (2/20) [8781914142 @ Sun Feb 07 22:35:29 +0000 2010] (#ds-scene@dssceners) (API): <+Antoligy> @Sephiii L4D SPOILER: THEY SURVIVE, LOUS GETS KILLED BY TEAM
<sp33chy> (3/20) [8781487406 @ Sun Feb 07 22:23:16 +0000 2010] (#ds-scene@dssceners) (API to 8781264615@dssceners): <@SignZ> @dssceners failed before :<
<sp33chy> (4/20) [8781462749 @ Sun Feb 07 22:22:32 +0000 2010] (#ds-scene@dssceners) (API): <@SignZ> @ 8781264615 @dssceners huh?

<speechles> !myfriends 3-6
<sp33chy> [Twitter]: [3-6] Friends timelines (#roms-isos@suqmuhnutz):
<sp33chy> (3/21) [8781487406 @ Sun Feb 07 22:23:16 +0000 2010] (#ds-scene@dssceners) (API to 8781264615@dssceners): <@SignZ> @dssceners failed before :<
<sp33chy> (4/21) [8781462749 @ Sun Feb 07 22:22:32 +0000 2010] (#ds-scene@dssceners) (API): <@SignZ> @ 8781264615 @dssceners huh?
<sp33chy> (5/21) [8781264615 @ Sun Feb 07 22:16:56 +0000 2010] (#ds-scene@dssceners) (API to 8781229179@dssceners): <+speechles> <+Antoligy> :O @dssceners :P
<sp33chy> (6/21) [8781242296 @ Sun Feb 07 22:16:17 +0000 2010] (#ds-scene@dssceners) (API): <+speechles> <+Antoligy> :O

<speechles> !public
<sp33chy> [Twitter]: [1-4] Public timelines (#roms-isos@suqmuhnutz):
<sp33chy> (1/21) [8793683598 @ Mon Feb 08 03:13:43 +0000 2010] (Silmy Kamila@silmy) (UberTwitter): Selamat bekerja @irawanmaulana Semoga ecstasy dan sabu-sabumu laku ya hari ini!
<sp33chy> (2/21) [8793683589 @ Mon Feb 08 03:13:43 +0000 2010] (Bunmi Kadiri@emyliaannerose) (Tumblr): When you finish reading this youll realize that you just wasted 5 seconds of your life. 6&7&8&9&why are you... http://tumblr.com/xf468myv5
<sp33chy> (3/21) [8793683585 @ Mon Feb 08 03:13:43 +0000 2010] (Jay Walker@jaylyrical) (web to 8793487845@DayAntonio): @DayAntonio i'm coming over to celebrate with you
<sp33chy> (4/21) [8793683581 @ Mon Feb 08 03:13:43 +0000 2010] (Camilo Martinez@camilonacho) (Tweetie to 8793626767@Animor_6): @Animor_6 holaaa como estai& recuerda que ando por tus tierras podriamos juntarnos un dia. Un abrazo.

<speechles> !public 10-11
<sp33chy> [Twitter]: [10-11] Public timelines (#roms-isos@suqmuhnutz):
<sp33chy> (10/21) [8793727913 @ Mon Feb 08 03:14:53 +0000 2010] (Miranda Starr@MirandaGDFL) (UberTwitter to 8793624897@richelleboo): @richelleboo Oh, that's gay dude :/ I got all happy. Um, sign me up on PinStack.com hahaha.
<sp33chy> (11/21) [8793727910 @ Mon Feb 08 03:14:53 +0000 2010] (mary genevieve@marygenevieve) (Tumblr): i am catching up on 24 hours of tumblr. - yall are just so addicting! once i finish, i will post.... http://tumblr.com/x4p68n03v
!myprofile, !myfriends, !myhome and !mymentions will all work and correspond to the timeline for each of these. You also have !public which will show the public timeline.

There is no way to paginate these requests yet. So your limited to only the first 20 or so. But this does allow you to gather message-id's and usernames which allows you to use the next added feature. You can reply-to others tweets using !tweet in your channels.
<sp33chy> (1/20) [8784484160 @ Sun Feb 07 23:39:59 +0000 2010] (#roms-isos@suqmuhnutz) (API): <speechles> * superGear (supergear@my.barbie.wears.no-panties.org) is now known as buttcrustjones
Say this tweet is something you want to reply to. To do so, you would merely need to know the message-id (8784484160) and the user-name (@suqmuhnutz) together you can reply to them on irc like this:

Code: Select all

!tweet @8784484160 superGear is always the butt of every joke. right @suqmuhnutz ? ;)
This will issue the tweet as a reply instead of just a normal tweet. You MUST use the @username of the message-id somewhere in your text. If you don't you will receive a message the tweet was issued as a reply, when it fact it was not. You can see the reply's in the quote box at the very top of this post. They appear as "API to #####" the #### being the message-id replied to.

Keep in mind that I've never used twitter before and the part that slows me down is having to figure out how twitters rest api even works... This script will slowly evolve hopefully into a fully fledged twitter client for eggdrop. It's already more than halfway there.. ;)

Still needed:
1) A way to delete tweets, or the very least delete the last tweet.
2) A way to follow and unfollow others
3) A way to add and remove friends
4) ??
5) PROFIT!!!

Here's the new script:Twitter & Tweets v3.3

stay tuned....
User avatar
MenzAgitat
Op
Posts: 118
Joined: Tue Jul 04, 2006 12:35 pm
Location: France
Contact:

Post by MenzAgitat »

I'm having troubles with base64 package on windrop 1.6.19.
After loading trf20.dll and base64.tcl, base64 encoding/decoding is working, but it have at least one side effect : each call to the MD5 tcl function returns the error

Code: Select all

cannot open crypt.dll
I found and tried to load crypt.dll but then it says :

Code: Select all

couldn't find procedure Crypt_Init 
while executing 
"load modules/crypt.dll"
Then, I found and tried that : http://www.sfr-fresh.com/unix/misc/exmh ... /crypt.tcl
Still no success...

I begin to think I took the wrong way.
Any suggestions (except replacing my windrop with eggdrop) ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

MenzAgitat wrote:I'm having troubles with base64 package on windrop 1.6.19.
After loading trf20.dll and base64.tcl, base64 encoding/decoding is working, but it have at least one side effect : each call to the MD5 tcl function returns the error

Code: Select all

cannot open crypt.dll
I found and tried to load crypt.dll but then it says :

Code: Select all

couldn't find procedure Crypt_Init 
while executing 
"load modules/crypt.dll"
Then, I found and tried that : http://www.sfr-fresh.com/unix/misc/exmh ... /crypt.tcl
Still no success...

I begin to think I took the wrong way.
Any suggestions (except replacing my windrop with eggdrop) ?
Did you try it the way I've suggested? I've got it working successfully on windrop 1.6.17.

http://downloads.sourceforge.net/projec ... b-1.12.zip

Download tcllib, but you don't need to install it. You just need to take the /base64 folder and place it in your \windrop\lib\tcl8.5\ folder and it will be detected. The "pkgIndex.tcl" tells tcl what the package is and how to use it. It also isn't required that you use Trf along with base64. It speeds up the process by a few milliseconds if you do use Trf, but if you don't the base64 will be processed in pure tcl. All base64 is used for is encrypting the username:password into an authorization string for twitter.
Post Reply