Author Topic: Google Plus  (Read 6360 times)

Amis

  • Newbie
  • *
  • Posts: 17
Google Plus
« on: May 05, 2008, 09:50:50 AM »
Attenion! This script is not my! he original script is made by Snerf, I just modified it and I added some needed fix together with Morio.
* Amis hugs Morio


Modifications:
-Don't spam channel with invalid url(s) when it hit a YouTube link with picture.
-Time limit to avoid excess flood.
-Won't give error when google return with no result.
-It export the results into the channel (bot-like function)
-Default result limited to 1. Can be modified to 5.
-It don't let you run script until you change your nickname to Google. Can be removed easily.

All credit goes to Snerf and Morio :)

I want to ask somebody to write a script into it that read words from an external file and use it to filter worlds like f**k or p**n.

And any additional suggestion welcome.


http://amis.weasy.net/googleplus.ice

Code: [Select]
-- CODE REMOVE --
« Last Edit: May 16, 2008, 12:29:37 PM by Snerf »

Amis

  • Newbie
  • *
  • Posts: 17
Re: Google Plus
« Reply #1 on: May 05, 2008, 10:59:56 AM »
Didn't find any EDIT button so i have to double post. Really sorry.

With the help of Morio i figured out how to make it use badwords.txt to dont reply at some words.

Insert this after "  If GetIdentifier("$me") = "Google" then  "  line
Code: [Select]
BadwordsLines = GetIdentifier("$lines(badwords.txt)")
For i=1 To BadwordsLines
CurrentBadword = GetIdentifier("$read(badwords.txt," & i & ")") 
If instr(search,CurrentBadword) > 0 then
SendCommand "/msg " & Channel & " " & Nick & " denied...",ServerNumber
Exit Sub
End If
Next

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Google Plus
« Reply #2 on: May 05, 2008, 11:51:34 AM »
Another small fix would be this. This way just typing "!google " won't cause an error.

Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If left(message,8) = "!google " and len(message) > 8 then
Google mid(message,9),Nickname,ServerNumber,Channel
End If
End Sub

I can muck around with the code and make it work with Youtube results as well. I will
post the fix for that later on.
The IceChat God

Amis

  • Newbie
  • *
  • Posts: 17
Re: Google Plus
« Reply #3 on: May 16, 2008, 07:06:16 AM »
Heres a new version of GooglePlus, many functions added and now it can show YouTube links too.

Changes:
-SETTINGS were added at the beggining of the file so you can easily modify any value without searching for it in the long script
-New commands
   !gban NICK - Ban the NICK's host. Affect !google and !last commands
   !gunban NICK - Unban the NICK's host. (Note: it says it unbanned the nick even if the nick wasn't banned)
   !floodlimit NUMBER - Set FloodLimit variable to NUMBER. Changing this increase or decrease the seconds you (all channel member) have to wait between two commands.
   !genable - Turn on the bot so !google and !last commands will be available.
   !gdisable - Turn off bot (Note: The bot says its ON or OFF even it was ON or OFF before the command)
   !last NICK - Shows the last !google search by NICK. Can be disabled in the SETTINGS section.
-You can set who (user group such as VOICE and OP) is able to use the commands in the SETTINGS section.
-When result contain YouTube link, the bot export "LINK | www.YouTube.com".
-Badword filter added (bw_list.txt) so you can avoid linking 18+ or any other links. You can define the words by yourself by editing the text file.

What you can set in SETTINGS:
-Floodlimit
-Owner name to be able to avoid being ignored at OP or other commands.
-Banfilter status (on/off)
-Bot startup status (on/off)
-Number of results on !google command (be carefull, don't set it higher than 3 or you may get kicked from channel)
-Search logging status (on/off)

Please if you have time test it and let me know if it has bugs or some settings should be changed.

Code: [Select]
-- CODE REMOVED --
Download script file: http://amis.weasy.net/googlefinal.ice
« Last Edit: May 16, 2008, 12:27:44 PM by Snerf »

Amis

  • Newbie
  • *
  • Posts: 17
Re: Google Plus
« Reply #4 on: May 16, 2008, 07:27:50 AM »
I made it again... I copy-paste an older version into the post, don't use it, it has another version of youtube (debug version). Download the real and working one from the link under it.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Google Plus
« Reply #5 on: May 16, 2008, 12:37:02 PM »
Just had a look at the script, you may want to fix some problems with the code.

Any time you have an IF statement, and do the THEN on the same line, you do not use END IF at the end, also if you place the ELSE on the same line.

Example:

Code: [Select]
If ISVOICE(Nickname,Channel,ServerNumber) = True then NickStatus = 2 End If
Should just be:

Code: [Select]
If ISVOICE(Nickname,Channel,ServerNumber) = True then NickStatus = 2
I must say though, you have taken a simple script, and made it into total over kill :)
The IceChat God

Amis

  • Newbie
  • *
  • Posts: 17
Re: Google Plus
« Reply #6 on: May 16, 2008, 10:40:21 PM »
Just had a look at the script, you may want to fix some problems with the code.

Any time you have an IF statement, and do the THEN on the same line, you do not use END IF at the end, also if you place the ELSE on the same line.

Example:

Code: [Select]
If ISVOICE(Nickname,Channel,ServerNumber) = True then NickStatus = 2 End If
Should just be:

Code: [Select]
If ISVOICE(Nickname,Channel,ServerNumber) = True then NickStatus = 2
I must say though, you have taken a simple script, and made it into total over kill :)


I didn't know about it... I always thought that in script ENTER have no meaning just to make it look better... Maybe its me and my Java knowledge..

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Google Plus
« Reply #7 on: May 16, 2008, 11:45:50 PM »
In VB Script, enter means a new line, unlike java, c++, and all those strong typed languages.
The IceChat God