But, I also need the script to recognized multiple words as a URL and turn them into a search. If the script can take the supplied words and put +'s instead of spaces the URL can also work like this.
I am not sure if this works, as I have been unable to test it at the moment due to being on a windows PC at this time.
This is a basic script performing the functions you asked for above. If it doesn't work, please find the error (get on dcc partyline and type: .set errorInfo <-) with the capital I on info. This will return the error output and allow us, or someone else, to fix the line(s) at fault.
# Gizoogle TCL - istok@IRCSpeed.org
# $Id: gizoogle.tcl,v1 25/07/2014 04:57:42am GMT +12 (NZST) IRCSpeed Exp $
## Syntax:
## !slang on
## !slang off
## !slang http://website.etc
## !slang www.website.etc
## !slang whatever you wanted to search
## /msg yourbot slang #channel on|off
# Set global trigger here
set pubtrig "!"
# -------- NO EDIT ---------
proc getTrigger {} {
global pubtrig
return $pubtrig
}
setudef flag gizoogle
bind pub - ${pubtrig}slang slang:pub
bind msg - slang slang:msg
proc slang:pub {nick uhost hand chan arg} {
if {[matchattr $hand o|m $chan]} {
if {[lindex [split $arg] 0] == ""} {puthelp "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]slang on|off|www.site.etc|search pattern"; return}
if {[lindex [split $arg] 0] == "on"} {
if {[channel get $chan gizoogle]} {puthelp "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
channel set $chan +gizoogle
puthelp "PRIVMSG $chan :Enabled Slang Command for $chan"
return 0
}
if {[lindex [split $arg] 0] == "off"} {
if {![channel get $chan gizoogle]} {puthelp "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
channel set $chan -gizoogle
puthelp "PRIVMSG $chan :Disabled Slang Command for $chan"
return 0
}
if {([lindex [split $arg] 0] != "") && ([lindex [split $arg] 1] == "*http://*") || ([lindex [split $arg] 1] == "*www.*")} {
if {![channel get $chan gizoogle]} {return}
set weblink [lindex [split $arg] 1]
puthelp "PRIVMSG $chan :http://www.gizoogle.net/tranzizzle.php?search=$weblink&se=Go+Git+Dis+Shiznit"
return 0
}
if {([lindex [split $arg] 0] != "") && ([lindex [split $arg] 1] != "") && ([lindex [split $arg] 2] != "")} {
if {![channel get $chan gizoogle]} {return}
set weblink [join [lrange [split $arg] 0 end]]
set extra [regsub -all -- {\s} "$weblink" +]
puthelp "PRIVMSG $chan :http://www.gizoogle.net/tranzizzle.php?search=$extra&se=Go+Git+Dis+Shiznit"
return 0
}
}
}
proc slang:msg {nick uhost hand arg} {
global botnick
set chan [strlwr [lindex [split $arg] 0]]
if {[matchattr $hand o|m $chan]} {
if {([lindex [split $arg] 0] == "") && ([string match "*#*" $arg])} {putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick gizoogle #channel on|off"; return}
if {([lindex [split $arg] 1] == "") && ([string match "*#*" $arg])} {putserv "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick gizoogle $chan on|off"; return}
if {[lindex [split $arg] 1] == "on"} {
if {[channel get $chan gizoogle]} {putserv "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
channel set $chan +gizoogle
putserv "NOTICE $nick :Enabled Slang Command for $chan"
return 0
}
if {[lindex [split $arg] 1] == "off"} {
if {![channel get $chan gizoogle]} {putserv "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
channel set $chan -gizoogle
putserv "NOTICE $nick :Disabled Slang Command for $chan"
return 0
}
}
}
putlog ".:LOADED:. gizoogle.tcl,v1 25/07/2014 04:57:42am GMT +12 (NZST) istok@IRCSpeed.org"
Hope it works.
Last edited by Get_A_Fix on Sat Sep 13, 2014 11:02 am, edited 9 times in total.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Ok so I put it in the scrtipts folder and eggdrop.conf. Then, I rehashed and it didn't crash! So I did .chanset and everything and then did !slang on and tried !slang http://www.google.com and still nothing... Also, you can run eggdrop on windows... Check out WinDrop.
Yes, I am fully aware of windrop and its capabilities. I would still prefer to test this on a local machine so I can inspect it and fix it much easier. I only run eggdrops, I would never run a windrop.
The above code works fine. It's now tested and perfected. Enjoy
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Updated: Try this again, AlphaTech, it works fine on my eggdrop1.6.21
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.