View previous topic :: View next topic |
Author |
Message |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 48 Location: United Kingdom
|
Posted: Wed Feb 09, 2022 3:51 pm Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 398
|
Posted: Wed Feb 09, 2022 4:17 pm Post subject: |
|
|
Well your package versions are slightly older than mine, but i really doubt that would be the cause of this problem.
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 |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 48 Location: United Kingdom
|
Posted: Wed Feb 09, 2022 5:08 pm Post subject: |
|
|
Hi,
Tried Searching Lego or anything at all, and it throws that error. 4 and below is fine. |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 398
|
Posted: Wed Feb 09, 2022 5:12 pm Post subject: |
|
|
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.  _________________ ComputerTech |
|
Back to top |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 48 Location: United Kingdom
|
Posted: Wed Feb 09, 2022 5:36 pm Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 398
|
Posted: Thu Feb 10, 2022 11:57 am Post subject: |
|
|
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.  _________________ ComputerTech |
|
Back to top |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 48 Location: United Kingdom
|
Posted: Fri Feb 11, 2022 3:12 pm Post subject: |
|
|
Thanks ComputerTech for taking the time. |
|
Back to top |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 82
|
Posted: Sat Feb 12, 2022 5:56 am Post subject: |
|
|
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 |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 48 Location: United Kingdom
|
Posted: Sat Feb 12, 2022 6:56 pm Post subject: |
|
|
Have you put the API Key In ?
And have you put in the Engine ID key in ? |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Sun Feb 13, 2022 5:33 am Post subject: |
|
|
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 |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 82
|
Posted: Mon Feb 14, 2022 12:45 am Post subject: |
|
|
You are always Right, CrazyCat  |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 398
|
Posted: Fri Mar 03, 2023 1:06 pm Post subject: |
|
|
New release of CT-google(it's now called Googler), feel free to reply with bugs or suggestions.
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 |
|
 |
Bosco Voice
Joined: 31 Oct 2022 Posts: 9
|
Posted: Fri Mar 03, 2023 5:36 pm Post subject: |
|
|
work good for me 0.4 |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 398
|
Posted: Fri Mar 03, 2023 10:10 pm Post subject: |
|
|
Bosco wrote: | work good for me 0.4 |
Awesome to hear!  _________________ ComputerTech |
|
Back to top |
|
 |
|