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 

CT-Google.tcl
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Dominatez
Halfop


Joined: 14 Jan 2019
Posts: 48
Location: United Kingdom

PostPosted: Wed Feb 09, 2022 3:51 pm    Post subject: Reply with quote

Code:

.tcl package require http
Tcl: 2.10a1
.tcl package require json
Tcl: 1.3.3
.tcl package require tls
Tcl: 1.7.20
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Wed Feb 09, 2022 4:17 pm    Post subject: Reply with quote

Well your package versions are slightly older than mine, but i really doubt that would be the cause of this problem. Laughing

This problem only happens when the variable is set to 5 correct? Plus did you try search another term? perhaps like "LEGO" for example, or something more popular perhaps.
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dominatez
Halfop


Joined: 14 Jan 2019
Posts: 48
Location: United Kingdom

PostPosted: Wed Feb 09, 2022 5:08 pm    Post subject: Reply with quote

Hi,

Tried Searching Lego or anything at all, and it throws that error. 4 and below is fine.
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Wed Feb 09, 2022 5:12 pm    Post subject: Reply with quote

Weird, as it's working just fine for me, i'll get another server of mine and try install the packages the same version that you have and try that. Rolling Eyes
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dominatez
Halfop


Joined: 14 Jan 2019
Posts: 48
Location: United Kingdom

PostPosted: Wed Feb 09, 2022 5:36 pm    Post subject: Reply with quote

If it helps. It is running on my own personal sever which is running

Ubuntu 20.04.03 LTS Focal
TCL Version 8.6
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Thu Feb 10, 2022 11:57 am    Post subject: Reply with quote

Yeah, i'm running Ubuntu 20.04 too, so that isn't the problem in my opinion, haven't had time yet to run another eggdrop on another server just yet, but i'll try make some time later. Razz
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dominatez
Halfop


Joined: 14 Jan 2019
Posts: 48
Location: United Kingdom

PostPosted: Fri Feb 11, 2022 3:12 pm    Post subject: Reply with quote

Thanks ComputerTech for taking the time.
Back to top
View user's profile Send private message
Goga
Halfop


Joined: 19 Sep 2020
Posts: 82

PostPosted: Sat Feb 12, 2022 5:56 am    Post subject: Reply with quote

Code:
[09:53:48] Tcl error in file 'eggdrop.conf':
 [09:53:48] can't read "::google": no such variable
     while executing
 "putlog "$::google.tcl v0.3 by ComputerTech Loaded""
     (file "scripts/search.tcl" line 116)
     invoked from within
 "source scripts/search.tcl"
     (file "eggdrop.conf" line 210)
 [09:53:48] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

Help Please...
Back to top
View user's profile Send private message
Dominatez
Halfop


Joined: 14 Jan 2019
Posts: 48
Location: United Kingdom

PostPosted: Sat Feb 12, 2022 6:56 pm    Post subject: Reply with quote

Have you put the API Key In ?

And have you put in the Engine ID key in ?
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1108
Location: France

PostPosted: Sun Feb 13, 2022 5:33 am    Post subject: Reply with quote

There is an error in the last line of the script:
Code:
putlog "$::google.tcl v0.3 by ComputerTech Loaded"


Must be:
Code:
putlog "CT-google.tcl v0.3 by ComputerTech Loaded"

_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
Goga
Halfop


Joined: 19 Sep 2020
Posts: 82

PostPosted: Mon Feb 14, 2022 12:45 am    Post subject: Reply with quote

You are always Right, CrazyCat Smile
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Fri Mar 03, 2023 1:06 pm    Post subject: Reply with quote

New release of CT-google(it's now called Googler), feel free to reply with bugs or suggestions. Cool

Code:
######################################################################################
# Googler.tcl
######################################################################################
#Author    ComputerTech
#IRC       ircs://irc.rizon.net:6697/computertech
#Email     computertech312@gmail.com
#GitHub    https://github.com/computertech312
#Version   0.4
#Released  03/03/2023
######################################################################################
# Description:
#
#               - An Elaborate Google Search Script.
#               - After 100 usages of the script, it will automatically stop until the next day.
#               - Grab your own API key from here
#                 https://developers.google.com/custom-search/v1/overview
#               - And a Engine ID from here
#                 https://cse.google.com/cse/
#             
# History:
#
#               - 0.4: Added safesearch option and fixed/improved code.
#               - 0.3: Added Max results option.
#               - 0.2: Fixed a few minor bugs.
#               - 0.1: First release.
#
######################################################################################

namespace eval Googler {

    #########################
   # Start of configuration.
   ##
   
    # Set the trigger command for the script
    variable trig !google
   
    # Set the flags for the script
    variable flags ofmn
   
    # Set the API key for the Google Custom Search API
    variable api_key "Your-API-Key"
   
    # Set the ID for the search engine associated with the API key
    variable engine_id "Your-Engine-ID"
   
    # Set the message type for the script
    #
    # The message type determines whether the output should be sent as a notice
    # to the user, a private message to the user, or a message to the channel.
    #
    # 0 = notice
    # 1 = private message
    # 2 = channel message
    variable message_type 2
   
    # Set the maximum number of search results to display
    #
    # This setting determines the maximum number of search results to display
    # in the output. The default is 3, but it can be set to any positive integer.
    variable max_results 3
   
    # Set the safe search mode for the script
    #
    # The safe search mode determines how explicit or potentially offensive
    # search results should be filtered. The available options are:
    #
    # "off": No filtering is applied.
    # "medium": Potentially explicit results are filtered, but not offensive
    #            content that is considered safe by some users.
    # "high": All explicit or potentially offensive content is filtered.
    #
    # The default setting is "high".
    variable safe_search "high"
   
   # Set logo
   variable logo "\0032G\0034o\0038o\0032g\0033l\0034e\003"
   
   #########################
   ## End of configuration.
   
    package require json
    package require tls
    package require http
    bind PUB $flags $trig [namespace current]::google_search
   
   proc google_search {nick host hand chan text} {
   http::register https 443 [list ::tls::socket]
   variable data [http::data [http::geturl "https://www.googleapis.com/customsearch/v1?[::http::formatQuery key $::Googler::api_key cx $::Googler::engine_id q [join $text +] safe $::Googler::safe_search]" -timeout 10000]]
   variable result_dict [::json::json2dict $data]
   variable search_info [dict get $result_dict "searchInformation"]
   variable search_results [dict get $result_dict "items"]
   variable num_results [dict get $search_info "formattedTotalResults"]
   variable search_time [dict get $search_info "formattedSearchTime"]
   switch -- $::Googler::message_type {
        "0" {set output "NOTICE $nick"}
        "1" {set output "PRIVMSG $nick"}
        "2" {set output "PRIVMSG $chan"}
    }
   variable output_string "$::Googler::logo About $num_results results ($search_time seconds)"
   putserv "$output :$output_string"
    foreach result [lrange $search_results 0 [expr {$::Googler::max_results - 1}]] {
        set title [dict get $result "title"]
        set link [dict get $result "link"]
        set snippet [dict get $result "snippet"]
        putserv "$output :$title / $link / $snippet"
    }
    http::unregister https
    http::cleanup $data
   
    putlog "$::Googler::logo.tcl v0.4 by ComputerTech Loaded"
   }
}

_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bosco
Voice


Joined: 31 Oct 2022
Posts: 9

PostPosted: Fri Mar 03, 2023 5:36 pm    Post subject: Reply with quote

work good for me 0.4
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 398

PostPosted: Fri Mar 03, 2023 10:10 pm    Post subject: Reply with quote

Bosco wrote:
work good for me 0.4

Awesome to hear! Cool
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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