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)

Post by speechles »

Toruk wrote:so how do i go about using the "artificial intelligence" on my bot?
You need to install megahal to get this behavior. Once installed, you need to train it's "aritifical intelligence". This is done with a *.trn file which is located in your eggdrop's root. This is merely a text file of sentences ending with newlines. The first time you start your eggdrop with megahal module loaded is the only time the *.trn file is of use. After this a *.brn and *.dic file are created and these are used subsequently. This is how the "intelligence" is built. You can then .chanset #yourchan +megahal and communicate with your bot on IRC by either prefixing what you say with it's nickname, or using it's nickname somewhere in what you say.

On twitter this behavior gets carried over. Your bot will communicate with people posting tweets to your profile, as long as those tweet's aren't a reply to an @username or an RT. It will also reply to people who @mention your username in their tweet. This will sometimes reply to usernames you wish it wouldn't. This is where the services list comes in. You merely +service the usernames you wish the bot not to reply to in @mentions. To have it reply to them again -service the usernames.

Megahal can also learn directly from these tweets if you have learning enabled for both of these functions. At present, these are the only two functions which involve "artificial intelligence".

Also, in june 2010, twitter will end support for basic authenticaion. Before that time I will have incorporated an Oauth for this script and it will have it's own application name. At that point storing passwords will no longer be required.

For an example of how this intelligence looks in use, see this profile, or this one, or even this one. On all 3, sp33chy is the eggdrop, running this exact script using megahal. One bot is doing all of it, yes. ;)
d
demonicpagan
Voice
Posts: 2
Joined: Mon May 10, 2010 11:25 pm

Post by demonicpagan »

If you don't mind me asking, what are you using for an oAuth library. I've written a Twitter script myself and am needing to convert to oAuth from basic authentication too.
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Hi,
thanks for your nice scripts, very usefull !
It's work perfect for me, but i have one question

- When a friends RT a guy, not RT by copy/paste ( it works ), but RT by click on "Retweet" the RT don't appears on the "friends timeline" on my channel :(
I must config it, or the "Retweet" button is a new fonction on twitter and it's not work with your twitter.tcl ? ( i'm new user of twitter )

sorry for my bad english :oops: and thanks again for your script :D
Last edited by kxng on Wed Jul 21, 2010 6:21 pm, edited 1 time in total.
i
ipbegg
Voice
Posts: 11
Joined: Sun Jun 14, 2009 7:44 am

Post by ipbegg »

[18:34] Tcl error [proc:twitter:friendsauto]: no such channel record
[18:35] Tcl error [proc:twitter:megahal:privatereply]: no such channel record

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

Post by Football »

[13:25:34] <EPL> [10:27] Tcl error [proc:twitter:friendsauto]: no such channel record

Another question, I`m using a rss script to direct the tweets to my room, is there a way to block my own written tweets?
Idling at #Football, Quakenet.
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

[07:13] RSS HTTP Error: https://twitter.com/statuses/friends_timeline.rss (HTTP/1.1 401 Unauthorized)


Since yesterday I`m getting this error, I haven't changed anything and now rss-synd.tcl doesn't output the tweets to my room.
Any idea what went wrong?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Huko wrote:[07:13] RSS HTTP Error: https://twitter.com/statuses/friends_timeline.rss (HTTP/1.1 401 Unauthorized)


Since yesterday I`m getting this error, I haven't changed anything and now rss-synd.tcl doesn't output the tweets to my room.
Any idea what went wrong?
LMFAO.. This was caused by twitters migration away from basic-auth to full oauth. There is nothing wrong, unless you meant that basic-auth no longer cuts it. But yes, it will be fixed. Just not quickly, because I'm not at home on a dedicated broadband connection. I'm at my parents in the middle of nowhere on their ridiculously capped satellite connection. I'll be back home the 4th or 5th and at that point I can address the issues with this script (adding oauth) and the google scipt (many functions broke). Until then, all we can do is wait and be patient. Hope this doesn't upset anyone, and if it does... well, it must take very little to upset you.. haw..

Expect an update to fix this and bring my twitter script into compliance with oauth sometime after the 4th/5th of September. Live long and prosper. May the force be with you. Have patience and don't give up hope. I'll be back soon and fix all the goodies I've released. ;D
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

As promised, OAuth is complete. This isn't the full OAuth dance, this uses single-token Access tokens which are all that is really required. The OAuth.tcl provided with this script is based off horgh's OAuth.tcl, but it's modified to use tcl lists instead of dict. Tcl8.5 code has been changed to Tcl8.4 friendly. Bugs which cause incorrect signatures corrected. The ability to use multiple single-accounts. As well as a complete, and robust error mechanism. Combined with the twitter.tcl I've written, OAuth.tcl is it's natural partner.

All that is required that wasn't before is SHA1 package (which is part of tcl-lib). So for this twitter script, you will need HTTP, BASE64, and SHA1 packages. If you also have MEGAHAL module this script allows you to extend its behavior onto twitter.

To use this script you must vist http://dev.twitter.com , login to your twitter account, and create an application. This will generate your consumer_key and consumer_secret tokens. On the same page that shows your tokens, click the button to the right that says [my tokens]. These will show your access_token_key and access_token_secret. Once you have all 4 of these tokens, insert them into the accounts section of twitter.tcl. This is all that is required as far as setting it up to use your accounts. The rest of the work will be done by OAuth.tcl as far as getting requests back from twitter.

Within twitter.tcl will be your normal config settings seperated into groups. Change any config setting to better suit your channel.

Here's is an example of a few functions from twitter:
<speechles> !tweet This is an example tweet to show egghelp users how this script functions now under OAuth.
<sp33chy> [Twitter]: Tweet created: 0s ago via sp33chy teh eggdrop at #roms-isos@efnet (24023768425@suqmuhnutz) #roms-isos @ http://twitter.com/suqmuhnutz
<speechles> !user 1-2
<sp33chy> [2-1] User timelines (#roms-isost@suqmuhnutz) @ http://twitter.com/suqmuhnutz :
<sp33chy> (02/20) 3m, 26s ago via sp33chy teh eggdrop at #roms-isos@efnet (24023768425@suqmuhnutz) (#roms-isos@efnet): <speechles> This is an example tweet to show egghelp users how this script functions now under OAuth.
<sp33chy> (01/20) 3m, 21s ago via sp33chy teh eggdrop at #roms-isos@efnet (24023775470@suqmuhnutz) (#roms-isos@efnet): <sp33chy> What script is sp33chy now.
As you can see above my application name is "sp33chy teh eggdrop at #roms-isos@efnet". Yours can be literally anything you choose. The bottom reply from "sp33chy" is the eggdrop's MegaHAL reply to my tweet on twitter.

TO INSTALL: You must have sha1 and base64 packages from tcl-lib. If you don't, then you must source base64.tcl and sha1.tcl (included in the zipfile below) before sourcing either OAuth.tcl or twitter.tcl. OAuth.tcl must be sourced before twitter.tcl. Other than that, you should have no problems with this script.

If you want an rss-script to read twitter feeds. Use this script, normal rss-readers cannot because they are not using OAuth.

Find the new script below:
OAuth, Twitter, Tweets, and MegaHAL v5.0
Works an any windrop/eggdrop 1.6.17 or higher with tcl 8.4 or higher

There may be slight issues or bugs in this release. If you experience any at all please feel free to post about them here and help get them resolved. Enjoy and have a fun. ;)
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

hey speechless, I have only one question, I didn't see any reference about using rss-synd to relay tweets from the account to IRC.

set rss(football) {
"url" "https://username:password@twitter.com/s ... meline.rss"


Does this need configuration?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Huko wrote:hey speechless, I have only one question, I didn't see any reference about using rss-synd to relay tweets from the account to IRC.

set rss(football) {
"url" "https://username:password@twitter.com/s ... meline.rss"


Does this need configuration?
Well, for one thing... The multi-function twitter script I wrote (which one of those functions is mimic rss feeds) isn't related at all to rss-synd. Rss-synd can no longer read protected resources on twitter (friends,mentions,home). All it can do is read your public profile with basic-auth.

What you do for the moment is use rss-synd in _combination_ with this twitter script. Rss-synd doesn't let you !tweet back to the twitter feed. The twitter script does.

With twitter you have these automated functions:
  • Display friends timelines just like rss
    Display mention timelines just like rss
    Automate MegaHAL replies into the profile
    Automate MegaHAL replies at mention timelines
You also have these functions users can do:
  • !tweet text here
    !user username x-y - see a user profile page; username is optional; x-y is optional range
    !myfriends x-y - your friends; x-y is optional range
    !mymentions x-y your mentions; x-y is optional range
    !myprofile x-y your profile; x-y is optional range
    !myhome x-y your home; x-y is optional range
    +follow - add a feed
    -follow - remove a feed
    !friends - list feeds
    !followers - list those reading your feed
    +service - add a username or list of usernames to the bot's MegaHAL ignore list
    -service - remove a username or list of username from bot's MegaHAL ignore list
    !services - list bot's MegaHAL ignore list
I will create an oauth package that can be used within rss-synd like a plug-on of sorts soon. This will give rss-synd the ability to use OAuth single use tokens and the ability to read twitters protected resources rss feeds. But at this point, to have both. You need to use both rss-synd and this twitter script. ;)
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

I didn't quite understand you speechless, I`ve made an application through that link and added the consumer_key and consumer_secret tokens, access_token_key and access_token_secret.
I added it to the login account section on twitter.tcl

What do I need to do next to make your twitter.tcl script work as a rss read for tweets?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Huko wrote:I didn't quite understand you speechless, I`ve made an application through that link and added the consumer_key and consumer_secret tokens, access_token_key and access_token_secret.
I added it to the login account section on twitter.tcl

What do I need to do next to make your twitter.tcl script work as a rss read for tweets?
Add your accounts to the twitter(accts) section within twitter.tcl. Then...

Source the 4 TCL's within twitter.zip in the CORRECT order.
If you don't have sha1 or base64 packages follow steps 1 and 2.
Otherwise skip them and start at step 3.
1) sha1.tcl
2) base64.tcl
3) oauth.tcl
4) twitter.tcl

# REMEMBER TO MAKE THIS WORK IN YOUR CHANNEL:
# Type in partyline: ".chanset #yourchannel +twitter"
# FOR MEGAHAL TO REPLY TO USERS WITHIN YOUR CHANNELS ACCOUNT:
# Type in partyline: ".chanset #yourchannel +twittermega"
# FOR @MENTIONS TO WORK:
# Type in partyline: ".chanset #yourchannel +twittermentions
# FOE MEGAHAL TO REPLY TO @MENTIONS:
# Type in partyline: ".chanset #yourchannel +twittermentionsmega"
# FOR FRIENDS TIMELIMES TO WORK:
# Type in partyline: ".chanset #yourchannel +twitterfriends"

Follow the config. If you don't have megahal on your bot, don't enable that feature. You want +twitterfriends and perhaps +twittermentions enabled. Then customize the output line to what you like. It's that easy.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

I'm getting:
[02:03:38] [&Trixar_za] !tweet Now I REALLY broke it good
[02:03:40] [GameBot] [Tweet]: OAuth failed: (401) Request: /1/statuses/update.json; Error: incorrect signature

Yes, I checked the order the scripts are loaded in: sha1, base64, oauth and twitter. Yes, I tried with sha1 and bash64 commented out - same error. Yes, I triple checked and made sure the customer_key, customer_secret, access_tokern_key and access_tokern_secret was right

So what might be the problem?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

hmm.. that is odd indeed...

Retry with this copy of the script. It corrects tiny mistakes here and there, maybe this solves it. Also, on your application page on twitter. Did you ask for BOTH read and write permissions? To tweet you need to do this. ;)
<speechles> !tweet Now I REALLY broke it good
<sp33chy> [Twitter]: Tweet created: 0s ago via sp33chy teh eggdrop at #roms-isos@efnet (24722093999@suqmuhnutz) #roms-isos @ http://twitter.com/suqmuhnutz

<speechles> !tweet \[{'hi'\]} testing special characters %&Q#@$&^^&!~'\/|+=-_**~``` etc etc
<sp33chy> [Twitter]: Tweet created: 0s ago via sp33chy teh eggdrop at #roms-isos@efnet (24723964488@suqmuhnutz) #roms-isos @ http://twitter.com/suqmuhnutz

<speechles> +follow suqmuhnutz
<sp33chy>[Twitter]: OAuth failed: (403) Request: /1/friendships/create.json; Error: could not follow user: you can't follow yourself!

<speechles> +follow secondpower
<sp33chy> [Twitter]: OAuth failed: (403) Request: /1/friendships/create.json; Error: could not follow user: you have been blocked from following this account at the request of the user.

<speechles> +follow badusernamensuch
<sp33chy> [Twitter]: OAuth failed: (404) Request: /1/friendships/create.json; Error: not found
This is _exactly_ how it works for me. The only time I see "oauth failed" messages is when twitter itself is giving me an error, user not found, can't follow yourself, etc..

If you still have problems after this let me know :)
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Same issue as before. I deleted and created a new app - this time as a web service rather than a client. Both times was set to read/write and I changed all the file permissions (including twitter.dat) to 777. Maybe it's the host or something just not working for me?
Post Reply