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.

online/offline in a greet

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

online/offline in a greet

Post by Snorly »

hello.
i was wondering if u can make me simple script that checks if site is online but it would say it when u come on channel like...

[11:08:40] * Now talking in #egghelp.org
[11:08:40] * Topic is 'bla bla bla'
[11:08:41] -bot- Welcome! the site www.egghelp.org is ONLINE!

and if the site is not online

[11:08:40] * Now talking in #egghelp.org
[11:08:40] * Topic is 'bla bla bla'
[11:08:41] -bot- Welcome! the site www.egghelp.org is OFFLINE!

tnx :)
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

i see no one replayed so this is hard?

you cant do it?
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Snorly wrote:i see no one replayed so this is hard?

you cant do it?
This has nothing to do with being "hard", nor with being able to do it.
My guess is that no one wants to do it.

This is a "request" forum, no one is obligated to make requests, I suggest a lot more patience.
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

oh i see :D tnx anyway
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

What's the website you will check status on/off ?
|AmDeAtH @ Undernet
Death is only the *Beginning*...
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

It's not in English so atleast I can't help I am sorry.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

u can make it in English and i will edit it. :)
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

iamdeath wrote:It's not in English so atleast I can't help I am sorry.
Snorly wrote:u can make it in English and i will edit it.
I believe iamdeath meant the websites.
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

oh ok i have some other website to check

so can u make it for -> http://www.filelist.org ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

package require http
set query "http://www.filelist.org"
set ua "Lynx"
set http [::http::config -useragent $ua]
catch {set http [::http::geturl "$query" -timeout [expr 1000 * 5]]} error
if {$error != "" } {
	putserv "NOTICE $nick :Welcome! the site ${query} is OFFLINE!"
} else {
	putserv "NOTICE $nick :Welcome! the site ${query} is ONLINE!"
}
I'm assuming that your request meant to only check if the site was loadable, not to actually scrape anything from it. The above snippet will accomplish it. Someone else can turn this into a full script for you if they care to, or you yourself can with basic tcl knowledge. :lol:
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

yes thats it :D can u add that i set a channel i dont want to greet with this on all channels :D
S
Snorly
Voice
Posts: 25
Joined: Mon Apr 17, 2006 2:44 pm

Post by Snorly »

and btw the bot does not greet me :S
thats what happends when i rehash the bot
[19:29:10] <h3lp> [19:50] -h3lp (help@users.si-shell.net)- Welcome! the site http://www.si-shell.net is OFFLINE!

but the web page is online
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Just because an error is returned doesn't mean its offline, speechles should of checked the error.

Maybe something like below:

Code: Select all

package require http

bind join -|- {*} greet:join

proc greet:join {nick uhost hand chan} {
  if {[string equal -nocase #mychannel $chan]} {
    set site "http://www.mysite.com"
    set useragent "Lynx"
    set timeout "5000"; # 1000 = 1 second
    http::config -useragent $useragent
    set token [http::geturl $site -timeout 5000]
    if {[http::status $token] == "error"} {
      putserv "NOTICE $nickname :Welcome! the site $site is OFFLINE!"
    } else {
      putserv "NOTICE $nickname :Welcome! the site $site is ONLINE!"
    } 
    http::cleanup $token
  }
}
Not tested.
r0t3n @ #r0t3n @ Quakenet
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

DragnLord wrote:
iamdeath wrote:It's not in English so atleast I can't help I am sorry.
Snorly wrote:u can make it in English and i will edit it.
I believe iamdeath meant the websites.
That's right. I could'nt understand the web language. :)
|AmDeAtH @ Undernet
Death is only the *Beginning*...
Post Reply