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: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?

Code: Select all

<speechles> .tcl set a [clock scan "2010-09-25 19:14:46 +0100"]
<sp33chy> Tcl error: unable to convert date-time string "2010-09-25 19:14:46 +0100"
<speechles> .tcl set a [clock scan "2010-09-25 19:14:46 CET"]
<sp33chy> Tcl: 1285438486
Find this in that bots eggdrop.conf:
set timezone "+0100"

Change that to:
set timezone "CET"

If it was already that, then something weird is happening when obtaining timezones on that bot.
T
Toruk
Voice
Posts: 8
Joined: Tue Apr 27, 2010 2:23 pm
Contact:

Post by Toruk »

Code: Select all

<speechles> .tcl set a [clock scan "2010-09-25 19:14:46 +0100"]
<sp33chy> Tcl error: unable to convert date-time string "2010-09-25 19:14:46 +0100"
<speechles> .tcl set a [clock scan "2010-09-25 19:14:46 CET"]
<sp33chy> Tcl: 1285438486
Find this in that bots eggdrop.conf:
set timezone "+0100"

Change that to:
set timezone "CET"

If it was already that, then something weird is happening when obtaining timezones on that bot.[/quote]

Ok, i looked but did not have "set timezone "+0100". I had "set timezone "GMT". Changed that to CET, but still the same after rehash and restart.

I even tried copying over my eggdrop.conf and running it on their server, but still the same :(
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: even tried copying over my eggdrop.conf and running it on their server, but still the same :(
As a quick hack to get it working on that weird bot, we can do this:

Code: Select all

lappend oauth_raw [list oauth_timestamp [clock scan [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S %Z"] -gmt 1]]
Find that in "oauth.tcl" and change it to:

Code: Select all

lappend oauth_raw [list oauth_timestamp [clock scan "[clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"] CET" -gmt 1]]
This will hard-code CET (GMT +1) onto it's timestamps during oauth transactions. This is a dirty way of fixing it. But sometimes it's good enough. ;)
T
Toruk
Voice
Posts: 8
Joined: Tue Apr 27, 2010 2:23 pm
Contact:

Post by Toruk »

That's sorted it, thanks for your help speechles :D
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Hello,
Sorry speechles for the delay :oops:
Like Toruk, the line you gave me doesn't work, but i take the last update of your tcl script, i don't have this error :) thanks for the fix !

I've got this error now,
<heh> !friends
<TwitterBot> [Twitter]: OAuth failed: (401) Request: /1/statuses/friends.json; Error: invalid / used nonce
<heh> !tweet bla
<TwitterBot> [Twitter]: OAuth failed: (401) Request: /1/statuses/update.json; Error: invalid / used nonce
It's no the same error than trixar_za, but I tried to put the http.tcl in the eggdrop script folder, and put it in eggdrop.conf, it's doesn't work. tested with http1.0 & http2.5

btw in the older script and the new one, i've got this error in pl :
Tcl error [proc:twitter:megahal:privatereply]: invalid command name "pulog"
I replaced pulog to putlog at line 1017 for 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:Hello,
Sorry speechles for the delay :oops:
Like Toruk, the line you gave me doesn't work, but i take the last update of your tcl script, i don't have this error :) thanks for the fix !

I've got this error now,
<heh> !friends
<TwitterBot> [Twitter]: OAuth failed: (401) Request: /1/statuses/friends.json; Error: invalid / used nonce
<heh> !tweet bla
<TwitterBot> [Twitter]: OAuth failed: (401) Request: /1/statuses/update.json; Error: invalid / used nonce
It's no the same error than trixar_za, but I tried to put the http.tcl in the eggdrop script folder, and put it in eggdrop.conf, it's doesn't work. tested with http1.0 & http2.5
Open oauth.tcl and make sure line 54 looks exactly as it is below:

Code: Select all

	lappend oauth_raw [list oauth_timestamp [clock scan [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S %Z"] -gmt 1]]
If it does look like this. Then you're timezone doesn't match the timezone the bot really is. In eggdrop.conf find: set timezone and change yours to the actual timezone the bot is using.
kxng wrote:btw in the older script and the new one, i've got this error in pl :
Tcl error [proc:twitter:megahal:privatereply]: invalid command name "pulog"
I replaced pulog to putlog at line 1017 for fix it
Thanks for the heads up. This has been corrected. ;)
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Thank you speechles !
the tcl script works perfect now :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 »

kxng wrote:Thank you speechles !
the tcl script works perfect now :D
Glad you got it going. ;)

http://twitter.com/twitterapi/status/22740827117

The url above should explain why converting bot timestamps to GMT is even needed.
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Thanks for the explanation :D
I want to have the RT from friends-timelines, are there an option i've missed ? I searched a little but i'm not good at tcl :/
Not the RT when you say RT @user, but the RT when you click on "retweet"
I translated your script to french, just for the putlog for now, if you're interested I can make a complete translation and pm the translated script :)
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:Thanks for the explanation :D
I want to have the RT from friends-timelines, are there an option i've missed ? I searched a little but i'm not good at tcl :/
Not the RT when you say RT @user, but the RT when you click on "retweet"
This is easily accomplished. The script just doesn't natively do that because it's usually quite spammy. But if you want it you can easily add it yourself. Let me show you how:

Within "proc:twitter:restapi" procedure, find:

Code: Select all

	if {[string match "otheruser*" $type]} {
		if {![string length [string trim [set who [string map {" " "_"} [join [lrange [split $type] 1 end]]]]]]} { set who "$tuser" }
		set other "?[http::formatQuery screen_name $who]"
		set q [list [list "screen_name" "$who"]]
		set type "user"
	} elseif {![string match "search*" $type]} {
		set other ""
		set q ""
	} else {
		if {![string length [string trim [set who [join [lrange [split $type] 1 end]]]]]} { set who "$tuser" }
		set other ""
		set q [list [list q [oauth:uri_escape  $who]]]
		set type "search"
	}
Change it to look like this:

Code: Select all

	if {[string match "otheruser*" $type]} {
		if {![string length [string trim [set who [string map {" " "_"} [join [lrange [split $type] 1 end]]]]]]} { set who "$tuser" }
		set q [list [list "screen_name" "$who"] [list include_rts true]]
		set type "user"
	} elseif {![string match "search*" $type]} {
		set q [list [list include_rts true]]
	} else {
		if {![string length [string trim [set who [join [lrange [split $type] 1 end]]]]]} { set who "$tuser" }
		set q [list [list q [oauth:uri_escape  $who]] [list include_rts true]]
		set type "search"
	}
This will _FORCE_ retweets to show in all restapi/search results. The variable "other" isn't required either. I've just left it there, as I migrated the script from basic authentication to full oauth. This is the reason you see it missing from my code change above. q contains the query to issue through oauth. This is a list, of lists, each sub-list containing a single name/value pair. This is to keep any special characters from being handled incorrectly. You can add more "entities" into the uri this way. There are alot that I don't make use of ;)
kxng wrote:I translated your script to french, just for the putlog for now, if you're interested I can make a complete translation and pm the translated script :)
You can release your translated version in this thread as well, so can others. Only a few of the messages can be user-edited, mainly because I prefer clean functionality over ease of configurability. Alot of the messages are "hard-coded" in English because of this. So of course for other users benefit, feel free to share these translated copies, by all means. Even in this thread ;)

BTW, to developers. oauth.tcl will work for _any_ eggdrop/tcl twitter script if you make a small (1/2 line) modification in your script where you presently use basic auth and http::geturl to do it. If you need help getting your script to do similar to this. I can show you how using the "oauth.tcl" this script includes. This is why it is included seperately ;) My twitter.tcl does not use "http::geturl", except when faking a web-browser and giving !twitter replies :D, other than that though everything is handled implicitly through oauth as the application and user matching it's credentials.
k
kxng
Voice
Posts: 6
Joined: Sun Jun 27, 2010 12:51 pm

Post by kxng »

Thanks speechles !
I'll try to do that :)
r
rhysm0e
Voice
Posts: 1
Joined: Tue Nov 02, 2010 8:47 pm

Post by rhysm0e »

speechles wrote:
Hey speechless, thank you for the great walk through. I am completely up and running with the exception of the time being off. I am GMT -5 hours, can you tell me how to add this properly? Further down in this thread you showed a "dirty fix" for the time issue. I copy and pasted like you suggest and tried to change the line for my timezone but was unsuccessful. I am EST GMT -5. Thanks in advance for your help.

I realized that may be a bit vague. By "time being off" i mean that it says a tweet was posted say 2 hours ago, but it just happened.
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 version.. YAY!!

This corrects some small bugs, presents a cleaner display and gives one new option to both oAuth.tcl and twitter.tcl.

New to oAuth.tcl is:

Code: Select all

# Use this to set your timezone on your bot. Most people
# should never need to change this. For FreeBSD you most
# likely will need to alter this.
set oauth_time "%Y-%m-%d %H:%M:%S %Z"
This allows you to hard-code timezones or other things into your oAuth timestamp. The "hack" above is no longer required, as this is a cleaner approach of it.

New to twitter.tcl is:

Code: Select all

# Use this to fix timestamp durations and correct
# issues synching your time to twitter's GMT time.
# Enter the seconds offset required below, to disable
# set this to 0. This is useful for Daylight savings 
# time adjustments, as well as other issues.
# Use either a Positive, or -Negative offset.
# (integer)
set twitter(fixMyDuration) "3600"
This is used to correct time offsets between your bot's time when converted to GMT vs twitter. This allows for daylight saving issues, Where europe is Oct31st yet America is Nov7th. For that week, I will need to keep FixMyDuration at 3600 to make up for this hour difference. You may have to do the same. This will also help adjust when your shell time, say is 40 or more seconds greater than twitter. You simply change the fixMyDuration above to 40. This can be set to positive or negative values depending upon the situation. If you need help explaining these, ask...

Here's a brief example of how it looks:
<sp33chy> Joystiq: Kinect is now available! Read our extensive launch coverage, including reviews of the hardware and launch titles: http://aol.it/aNtFje ( 29638602568@joystiq - 25s ago via Tweetie for Mac )
<sp33chy> IGN: The Kinect reviews are in! Check out our complete Microsoft #Kinect coverage here. | http://go.ign.com/9fFp7p ( 29638659561@IGN - 30s ago via web )
<sp33chy> GameSpot.com: RUMOR: Kinect has problems recognizing dark-skinned users? http://gamespot.com/6283514 ( 29638688665@gamespot - 1s ago via HootSuite )
<sp33chy> Kotaku: Review: Kinect http://kotaku.com/5680501/ ( 29638728475@Kotaku - 22s ago via kotaku )
Get the new script: OAuth, Twitter, Tweets & MegaHAL v5.01
s
s1lenz
Voice
Posts: 1
Joined: Thu Nov 04, 2010 11:32 pm

Post by s1lenz »

I'm getting the message 20:39] Tcl error [proc:twitter:megahal:privatereply]: can't use empty string as operand of "-" even though I have megahal off. Any ideas?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

s1lenz wrote:I'm getting the message 20:39] Tcl error [proc:twitter:megahal:privatereply]: can't use empty string as operand of "-" even though I have megahal off. Any ideas?

Code: Select all

# Use this to fix timestamp durations and correct
# issues synching your time to twitter's GMT time.
# Enter the seconds offset required below, to disable
# set this to 0. This is useful for Daylight savings 
# time adjustments, as well as other issues.
# Use either a Positive, or -Negative offset.
# (integer)
set twitter(fixMyDuration) "0"
Make sure this setting is 0, and not "". Then it should work as expected. If after you tweet, you notice time is off. Use this setting to adjust your durations to accuracy.
Post Reply