egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Slang Search

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
AlphaTech
Voice


Joined: 23 Jul 2014
Posts: 12
Location: New York, USA

PostPosted: Wed Jul 23, 2014 10:21 pm    Post subject: Slang Search Reply with quote

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?search=http://exaple.com&se=Go+Git+Dis+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?search=PUT_URL_HERE&se=Go+Git+Dis+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?search=YOUR+SEARCH+HERE&se=Go+Git+Dis+Shiznit

Thank you and I hope this can be done! IF you have a question, feel free to leave a comment below! Smile
Back to top
View user's profile Send private message Send e-mail
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Thu Jul 24, 2014 1:45 pm    Post subject: Slang Command (gizoogle.tcl) Reply with quote

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:

# 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.
_________________
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.


Last edited by Get_A_Fix on Sat Sep 13, 2014 11:02 am; edited 9 times in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
AlphaTech
Voice


Joined: 23 Jul 2014
Posts: 12
Location: New York, USA

PostPosted: Thu Jul 24, 2014 4:48 pm    Post subject: Re: Slang Search Reply with quote

Ok so I put it in the scrtipts folder and eggdrop.conf. Then, I rehashed and it didn't crash! Smile 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
Back to top
View user's profile Send private message Send e-mail
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Fri Jul 25, 2014 4:09 pm    Post subject: Re: Slang Search Reply with quote

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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sat Sep 13, 2014 11:03 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber