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 »

Trixar_za wrote: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?
Let me explain a little more just to clarify it all.
01) Go to http://twitter.com and login to your account
02) After your logged in, visit this url: http://dev.twitter.com/apps/new
03) Fill out the form. Choose CLIENT and READ/WRITE/DIRECT MESSAGE Access. The rest you can choose anything. Submit the form.
04) Copy your Consumer_key and Consumer_secret into a text editor.
05) Click the [my access token] button on the right.
06) Copy your Access Token (oauth_token) and your Access Token Secret (oauth_token_secret) into the same text editor
07) Extract the entire contents of twitter.zip into your scripts/ folder.
08) open twitter.tcl and find the twitter(accts) section
09) add your accts copying them from the text editor (this helps alleviate any typos) and make sure you follow the ordering set below.
"#chan|acct|consumer_key|consumer_secret|access_token_key|access_token_secret"
10) save twitter.tcl
11) open eggdrop.conf
12) edit eggdrop.conf adding the following scripts in the order below:
If you have tcl-lib installed omit sourcing sha1 and base64
source scripts/sha1.tcl
source scripts/base64.tcl
source scripts/oauth.tcl
source scripts/twitter.tcl
13) save eggdrop.conf
14) .rehash, .restart, or start your bot
15) log into partyline and issue the following commands.
.chanset #yourchan +twitter
.chanset #yourchan +twitterfriends
.chanset #yourchan +twittermentions
.chanset #yourchan +twittertrack
.chanset #yourchan +twitterfollowers
if you have megahal on your bot, you can also enable that
.chanset #yourchan +twittermega
.chanset #yourchan +twittermentionsmega
16) try to check your status, type !user in #yourchan
17) try to check your friends, type !friends in #yourchan
18) try to follow someone, type +follow username
19) try to track some search terms, type +track this that
20) try to tweet, type !tweet some stuff here
If any of these steps fail for you, note which step and it will be easier to offer help knowing that you've followed how this needs to be setup. ;)
Last edited by speechles on Wed Jul 13, 2011 12:30 am, edited 4 times in total.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Followed all the steps, but !tweet still isn't working. Funny enough everything else is:
[20:01:01] [&Trixar_za] !user
[20:01:06] [GameBot] [4-1] User timelines (#IRC-Wiki@ircwiki) @ http://twitter.com/ircwiki :
[20:01:06] [GameBot] (04/20) 13w, 1d, 16h, 47m, 26s ago via web (16350544524@IRCWiki) (IRC Wiki): IRC Wiki is currently undergoing some theme changes, and they are looking terrific! Watch this space! -=- http://irc-wiki.org
[20:01:07] [GameBot] (03/20) 11w, 5d, 19h, 39m, 9s ago via API (17121387159@IRCWiki) (IRC Wiki): Added Genshi Code Highlighting, Live Chat & reduced the nav menu. Round Corners work in all NEW browsers (but IE)! - http://www.irc-wiki.org
[20:01:08] [GameBot] (02/20) 9w, 3d, 22h, 54m, 57s ago via mobile web (18375492682@IRCWiki) (IRC Wiki): We're busy revamping thanks to MrJones and we're finally completely SEO'd! Great Changes ahead! http://www.irc-wiki.org
[20:01:10] [GameBot] (01/20) 17h, 20m, 10s ago via web (24712237563@IRCWiki) (IRC Wiki): We added a forum to The IRC Wiki. Have your say in our future developments & plans - So come and register already! - http://www.irc-wiki.org
[20:01:43] [&Trixar_za] !friends
[20:01:47] [GameBot] [Twitter]: [#IRC-Wiki@ircwiki] (following): NixtaServices, IRCResource, roomsapp, echelon4, ChatcabinIRC, JanusIRC, Badger09, UKMadZone, IHNIirc, OptixIRC, EFNet, InsaneIRC, vipa5000, miniCruzer911, EPL_Quakenet, RiftNET, Wikipedia, IRC_Tech, SporksIRC, FailBot_IRC_Bot
[20:01:48] [GameBot] [Twitter]: [#IRC-Wiki@ircwiki] (following): ircjunkie, InsideIRC, NerdHerdIRC, jflusmanjr, ircpowerscl, OW_IRC, citrixirc, eLeetIRC, theirctrout, furnet, geekupirc, ircbrasil, rev3irc, infrabot, techgeek93, auronianews, frigidtech, RussellB28, xTremeGeekIRC, ConflictIRC
[20:01:49] [GameBot] [Twitter]: [#IRC-Wiki@ircwiki] (following): Incredibots, synirc, lightIRC, colloquyapp, owircnet, VillageIRC, 6667irc, FlowChat, SwiftBNC, WebChatIRC, WMnetwork, devilsfreek, freenodestaff, espernet, ngIRCd, EvonyIRC, wikkedwire, xTremeIRC, TECLifeIRC, DefconIRC
[20:01:52] [GameBot] [Twitter]: [#IRC-Wiki@ircwiki] (following): GeeksIRC, LobbyZNC, crypthon_ircnet, BNC4FREE, NoAgendaChat, WyldRyde, InfinityIRC, alphairc, SassIRC, solidirc, SwiftIRC, FknBish, trixarian, gigchat, QuoteBucket, ircjunkieorg, TheBotsirc, HawkeeBot, IRCHighWay, mibbit
[20:01:55] [GameBot] [Twitter]: [#IRC-Wiki@ircwiki] (following): Hawkee, twitter, pastebincom, Fighterlegend, hyruledotnet, DDuckieDD, Lyhne1, Joah1991, Straightos, IRCReport, pumford10, ahylianhuman, NixtrixIRC, TornadoIRC, InnerIRC, zncbouncer, GeekShed, qdb, RScript
[20:02:11] [&Trixar_za] +follow gignet
[20:02:13] [GameBot] [Twitter]: Successful Follow: [Nessy Rayne@gignet] (1 Friends; 2 Followers) @ http://twitter.com/gignet
[20:02:23] [&Trixar_za] -follow gignet
[20:02:25] [GameBot] [Twitter]: Successful Unfollow: [Nessy Rayne@gignet] (1 Friends; 2 Followers) @ http://twitter.com/gignet
[20:02:27] [GameBot] @Mention 23w, 1d, 20h, 26m, 39s ago (11787726626@vipa5000) (Terrance Robotham): @IRCWiki Useful IRC Sites (http://www.irc-wiki.org/IRC+Sites) > http://archives.darenet.org"}
[20:02:39] [&Trixar_za] nice
[20:03:04] [&Trixar_za] !tweet Hopefully the bot is working now and you all can see this tweet
[20:03:06] [GameBot] [Twitter]: OAuth failed: (401) Request: /1/statuses/update.json; Error: incorrect signature
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Trixar_za wrote:[20:03:04] [&Trixar_za] !tweet Hopefully the bot is working now and you all can see this tweet
[20:03:06] [GameBot] [Twitter]: OAuth failed: (401) Request: /1/statuses/update.json; Error: incorrect signature
I'm betting this is an http-package versioning (fragmentation) problem. Eggdrop has tons of these. Try just:

!tweet oneword

If this works, it's definitely the issue of spaces being treated as +'s rather than as %20's. I prefer to treat them as what they are %20's.

But, I won't leave you hanging. We can solve this possibly. By "we" I mean, you need to do some work investigating too. To do this investigating, I can give you a proper debug version of oauth.tcl. Replace oauth.tcl with oauth-debug.tcl renaming it. Afterwards, watch your query window. After you !tweet your bot will begin a series of messages to you. These will help figure out exactly where in the OAuth process things are being mangled. The most IMPORTANT parts to know are: OAUTH_RAW, OAUTH_HEADER, BASE_STRING and MY_QUERY. Of course obscure your oauth tokens if you care not to disclose them. The part I want to see involves the sort-order to the oauth_header and oauth_raw, as well as how the oauth_header matches up to my_query.
# Incorrect signature, other errors pissing you off.
# Get the inside look at every oauth transaction via query
# set your debug nick here
set oauthdebug ""
The debug version has this setting within it. You need to add your nickname where it has "". When we solve it, you can change this back to "" and continue to just use the debug version rather than switch back to the orignal oauth.tcl.

Anyone else using this script successfully? Chime in please.
Anyone else using this script unsuccessfully? Chime in as well. :)
Last edited by speechles on Fri Sep 17, 2010 3:08 pm, edited 1 time in total.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

EDIT: Clearned so people can't abuse the info :P
Last edited by Trixar_za on Fri Sep 17, 2010 5:29 pm, edited 1 time in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Trixar_za wrote:Here you go:

In the channel:

Code: Select all

[21:02:58] [&Trixar_za] !tweet one
[21:03:22] [GameBot] [Twitter]: OAuth failed: (401) Request: /1/statuses/update.json; Error: incorrect signature
In private:

Code: Select all

[21:03:22] [GameBot] my_query status=%3CTrixar_za%3E+one
AHA! On speaking with a twitter API developer advocate, it seems that http package has indeed undergone a change in it's versioning. The version of http package I'm using (2.5.3) encodes spaces as %20's. This is how twitter wants them. It is confusing having them as +'s. The version your using, is encoding them as +'s. This is evident by your my_query line above.

Code: Select all

my_query status=%3Cspeechles%3E%20testing
Mine on the other hand, is using %20. This is one of the problems on using libraries. If you can confirm this and give the http package version your using this can then be easily solved.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

By the looks of it, I'm using http package 2.5.2 - so there must have been one hell of a change between 2.5.2 and 2.5.3 to present this issue hey?

Code: Select all

% puts $tcl_version
8.4
% package require http
2.5.2
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Trixar_za wrote:By the looks of it, I'm using http package 2.5.2 - so there must have been one hell of a change between 2.5.2 and 2.5.3 to present this issue hey?

Code: Select all

	# These are handled specially
	array set map { " " + \n %0d%0a }
	variable formMap [array get map]
Find the above in your copy of http.tcl
it's located in either: /lib/tcl8.4/ --or-- /lib/tcl8.4/http2.5
Change it to look like it is below:

Code: Select all

	# These are handled specially
	set map(\n) %0d%0a
	variable formMap [array get map]
This is the BIG change that occured that basically broke it. Changing this will fix it all and you will be solved. ;)
Last edited by speechles on Fri Sep 17, 2010 4:45 pm, edited 2 times in total.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

% set value [http::formatQuery "this is my text"]
this+is+my+text
% set value [http::formatQuery "this"]
this
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

see my above post, you beat me to the edit.. ;)

Make sure to set the oauth debugnick to "" again and .rehash your bot. Sending all those debug messages will slow your bot down considerably.
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

I don't think they'd allow me to do that on a shell host ;) - so I just copied it from /usr/share/lib/tcl8.4/http2.5/ into my scripts folder directly and loaded it first with eggdrop.conf instead.

Now it works perfectly. Thanks for the effort speechles :)
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Hello,
I've got a problem with the new tcl script :cry:
After editing the tcl script, i start the bot and i try !friends, !myprofile, !tweet bla, etc etc
All the commands gave me this error :

Code: Select all

[02:54:28] <TwitterBot> [Twitter]: unable to convert date-time string "mar sep 21 22:54:26 GMT  2010"
I checked my eggdrop.conf configuration, and tried to change timezone here, but nothing change :/ actually i'm on GMT +2

Code: Select all

[02:37:10] <TwitterBot> [Twitter]: unable to convert date-time string "mer sep 22 02:37:06 GMT  2010"
In the older script, there was this option : set twitter(timezone) " 2"
This option isn't in the new script :(
How can i fix it ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

kxng wrote:In the older script, there was this option : set twitter(timezone) " 2"
This option isn't in the new script :(
The script no longer needs to know what timezone your in. This was due to logic I've changed in the script when dealing with twitter timestamps. Before it converted your time to GMT, and matched this to twitters to attain a duration. Doing this requires knowing the bots timezone and that config setting.

The way it does it now, it changes twitter's timestamp into your timezone. The twitter script doesn't need to know your timestamp in a config setting to do this. This is done by tcl's [clock scan] using the GMT option which happens to be exactly what twitter timestamps are based on.
kxng wrote:Hello,
I've got a problem with the new tcl script :cry:
After editing the tcl script, i start the bot and i try !friends, !myprofile, !tweet bla, etc etc
All the commands gave me this error :

Code: Select all

[02:54:28] <TwitterBot> [Twitter]: unable to convert date-time string "mar sep 21 22:54:26 GMT  2010"
I checked my eggdrop.conf configuration, and tried to change timezone here, but nothing change :/ actually i'm on GMT +2

Code: Select all

[02:37:10] <TwitterBot> [Twitter]: unable to convert date-time string "mer sep 22 02:37:06 GMT  2010"
How can i fix it ?
Why do you have those "mar" and "mer" things there? Your twitter timestamp should look something like below:

Code: Select all

Fri Feb 12 02:13:28 GMT +0000 2010
The script attempts to strip the GMT part out of the timestamp along with the day of the week at front, so that eggdrop can natively read it. Your timestamp is too long in front for some reason. Making the code change shown to the procedure shown below will let you see the timestamp if it cannot attain a duration. When you see this, let me know what it is so I can fix it for you.

The problem comes from how I get eggdrop to read twitter's timestamp. It cannot normally it is non-standard. Here is the entire duration procedure which convert's twitters timestamp of the event into a duration ago displayable on IRC.

Code: Select all

proc proc:twitter:duration {date {value 0}} {
	set newdate [join [lrange [lreplace [split $date] 5 5] 1 end]]
	if {$value ==1} { return [clock scan "$newdate" -gmt 1] }
	set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]]
	set ago [string map {" years " "y, " " year " "y, " " weeks" "w, " " week" "w, " " days" "d, " " day" "d, " " hours" "h, " " hour" "h, " " minutes" "m, " " minute" "m, " " seconds" "s, " " second" "s,"} $ago]
	return "[string trim $ago ", "] ago"
}
Replace this part:

Code: Select all

set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]]
With this:

Code: Select all

if {[catch { set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]] } error]} { return $date }
In future versions of this script, this will be included for other such cases that may arise, and also expect the "search" feature to be included.
<speechles> !tsearch eggdrop twitter
<sp33chy> [Twitter]: There is nothing to display for search with "eggdrop twitter". :(

<speechles> !tsearch eggdrop
<sp33chy> [4-1] Search timelines (#roms-isos@suqmuhnutz):
<sp33chy> (04/08) 3d, 5h, 25m, 40s ago via Osfoora for iPhone (24950334584@julez29): @bitchylibrarian it doesn't have to be spicy. Just a couple of drops to give it some flavor. Atleast in the ramen noodles. Eggdrop soup- YUM
<sp33chy> (03/08) 2d, 7h, 29m, 48s ago via Twitter for BlackBerry® (25031644395@masreza): Bener neh gue jg perlu bukti ! Uud cman bisa mijet eggdrop RT @drhonk: I don't believe it .. no pics = hoax ! hahah RT @myadena: hubby
<sp33chy> (02/08) 2d, 5h, 4m, 49s ago via Mobile Web (25043171153@beccabrand): @slimthugga eggdrop soup w beef ?
<sp33chy> (01/08) 1d, 3h, 29m, 9s ago via web (25143003446@BrianFukushima): Whipped up a hot n sour soup brew. #hotvinegarlove #eggdrop
There will also be formatting templates for each channel, so that every channel can have different display attributes. I've had users complain that certain things like duration ago, application name, and position indexes aren't needed when the updates are shown in real time. You may agree, hence it will be included. I've also fixed some other things like tweet "ago" is actually when you created the account, not the tweet. This is now done by checking both times against themselves and taking the later timestamp. Expect new version this weekend along with a possible "google" update (!book !ebay !youtube !etc) all those broken things fixed too. :D
T
Toruk
Voice
Posts: 8
Joined: Tue Apr 27, 2010 2:23 pm
Contact:

Post by Toruk »

kxng wrote:Hello,
I've got a problem with the new tcl script :cry:
After editing the tcl script, i start the bot and i try !friends, !myprofile, !tweet bla, etc etc
All the commands gave me this error :

Code: Select all

[02:54:28] <TwitterBot> [Twitter]: unable to convert date-time string "mar sep 21 22:54:26 GMT  2010"
I checked my eggdrop.conf configuration, and tried to change timezone here, but nothing change :/ actually i'm on GMT +2

Code: Select all

[02:37:10] <TwitterBot> [Twitter]: unable to convert date-time string "mer sep 22 02:37:06 GMT  2010"
How can i fix it ?
The problem comes from how I get eggdrop to read twitter's timestamp. It cannot normally it is non-standard. Here is the entire duration procedure which convert's twitters timestamp of the event into a duration ago displayable on IRC.

Code: Select all

proc proc:twitter:duration {date {value 0}} {
	set newdate [join [lrange [lreplace [split $date] 5 5] 1 end]]
	if {$value ==1} { return [clock scan "$newdate" -gmt 1] }
	set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]]
	set ago [string map {" years " "y, " " year " "y, " " weeks" "w, " " week" "w, " " days" "d, " " day" "d, " " hours" "h, " " hour" "h, " " minutes" "m, " " minute" "m, " " seconds" "s, " " second" "s,"} $ago]
	return "[string trim $ago ", "] ago"
}
Replace this part:

Code: Select all

set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]]
With this:

Code: Select all

if {[catch { set ago [duration [expr {[clock seconds] - [clock scan "$newdate" -gmt 1]}]] } error]} { return $date }

I too have this error, and changing the line of code that you said did not work for me :(

Hope we can find this 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 »

Toruk wrote:I too have this error, and changing the line of code that you said did not work for me :(

Hope we can find this problem.
Thanks for reporting that my initial code fix was not sufficient. ;)

So we can move on to assume, since every command is affected that it must be something within "oauth" and not within "twitter". On checking the oauth_timestamp generation code and speaking with thommey on #eggtcl/efnet he offered a simple solution.

Code: Select all

	lappend oauth_raw [list oauth_timestamp [clock scan [clock format [clock seconds]] -gmt 1]]

	lappend oauth_raw [list oauth_timestamp [clock scan [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S %Z"] -gmt 1]]
The top line of code is the original way it was. When translated clock names are fed to this it will cause the problem described. The second line is thommey's, it uses format to convert these not to translated names, but to numeric dates.

The reason for needing this at all is because twitter wants you to give it a timestamp of your request. This timestamp cannot be based on your timezone it has to be based on GMT which twitter wants. This part accomplishes that now much better.

This is a rushed release to correct this error. Therefore not everything I've mentioned earlier is included. You do have the addition of searching, with !tsearch though. But there are not multiple output templates in place yet. Try this version out (especially those using foreign languages) and give it a whirl and let me know how it is.. ;)

and as always, have a fun and dance like an robot...

find the newest version, below:
OAuth, Twitter, Tweets & MegaHAL v5.01
T
Toruk
Voice
Posts: 8
Joined: Tue Apr 27, 2010 2:23 pm
Contact:

Post by Toruk »

Hi speechles

I have installed the new version on my eggdrop and it works fine. Timestamp is spot on.

I then installed it exactly the same (except the tokens) on a friends eggdrop and we are still getting the:

"unable to convert date-time string "2010-09-25 19:14:46 +0100"

Now i looked into it a bit more and thought, well it cant be anything wrong on the script as its working on mine.

The one thing i found is that the time on my server is one hour behind my local time, whereas my friends server is our local time, one hour difference. Maybe why it is saying +0100" on hers?
Post Reply