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.

Slang Search

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
A
AlphaTech
Voice
Posts: 12
Joined: Wed Jul 23, 2014 1:07 am
Location: New York, USA

Slang Search

Post by AlphaTech »

I'm new to eggdrop and tcl files so I can't code them or anything like that but, I heard this is a pretty easy task for a script writer.

Command: !slang <url or search>

Ok so when someone does !slang http://www.example.com I need it to return with the http://www.gizoogle.net URL.

Example:
<AlphaTech> !slang http://example.com

<MyBot>http://www.gizoogle.net/tranzizzle.php? ... is+Shiznit

The trick is to take the URL and put it in the PUT_URL_HERE area of this link

Link:
http://www.gizoogle.net/tranzizzle.php? ... is+Shiznit

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.

<AlphaTech> !slang YOUR SEARCH HERE

<MyBot> http://www.gizoogle.net/tranzizzle.php? ... is+Shiznit

Thank you and I hope this can be done! IF you have a question, feel free to leave a comment below! :)
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Slang Command (gizoogle.tcl)

Post by Get_A_Fix »

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.

Code: Select all

# 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.
A
AlphaTech
Voice
Posts: 12
Joined: Wed Jul 23, 2014 1:07 am
Location: New York, USA

Re: Slang Search

Post by AlphaTech »

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.

Edit: It does show up on .binds
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Re: Slang Search

Post by Get_A_Fix »

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.
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

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.
Post Reply