| View previous topic :: View next topic |
| Author |
Message |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Apr 20, 2008 6:03 pm Post subject: |
|
|
| ztian299 wrote: | | Code: |
Command bindings:
TYPE FLGS COMMAND HITS BINDING (TCL)
notc -|- search 0 notice:search
|
This is what I get in telnet.. |
This shows that your notice binding has not been triggered..
Abit embarrased I did'nt notice this until now, but well, here it goes...
| Quote: | (7) NOTC (stackable)
bind notc <flags> <mask> <proc>
procname <nick> <user@host> <handle> <text> <dest>
Description: dest will be a nickname (the bot's nickname,
obviously) or a channel name. mask is matched against the entire
notice and can contain wildcards. It is considered a breach of
protocol to respond to a /notice on IRC, so this is intended for
internal use (logging, etc.) only. Note that server notices do
| not trigger the NOTC bind. If the proc returns 1, Eggdrop will
| not log the message that triggered this bind.
New Tcl procs should be declared as
proc notcproc {nick uhost hand text {dest ""}} {
global botnick; if {$dest == ""} {set dest $botnick}
...
}
for compatibility.
Module: server
|
Especially this part: ...mask is matched against the entire notice and can contain wildcards....
Change the binding into something like this:
| Code: | | bind notc -|- "search *" notice:search |
Also change your proc slightly:
Set the site variable like this instead:
| Code: | | set site [lindex [split $text] 1] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Sun Apr 20, 2008 6:15 pm Post subject: |
|
|
net-type 5 is right, because I'm not on the listed servers.
why do I need to make a fresh conf? this config have been working very well for me in long time with all other scripts.
Any other suggestions for my problem? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Apr 20, 2008 6:18 pm Post subject: |
|
|
It's not a config-problem, so I'd suggest you leave it as is for now. Focus on getting the binding corrected first (see my previous post).
(if it ain't broken, don't fix it) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Sun Apr 20, 2008 6:25 pm Post subject: |
|
|
My fault! didn't read page 2 of this thread! sorry..
Ok, I'll try all your tip now! hope it works |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Apr 20, 2008 7:43 pm Post subject: |
|
|
| nml375 wrote: | | Abit embarrased I did'nt notice this until now |
In deed, we were beating around the bush  _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Mon Apr 21, 2008 10:58 am Post subject: |
|
|
Thanks a lot for helping me out.. after some .rehash and .restart everything works like it should!
But I want the outputs from SELECT query in each line..
like:
<me> /notice bot search egghelp
<bot> http://egghelp.org
<bot> http://forum.egghelp.org
how is this possible?
I've tried with LIMIT 5, but then it shows like this:
<bot> http://egghelp.org http://forum.egghelp.org |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Apr 21, 2008 11:26 am Post subject: |
|
|
mysqlsel can output a valid list (using the -list command). With lists, you can use various list-commands, such as foreach:
| Code: | foreach line [mysqlsel $db $query -list] {
puthelp "PRIVMSG $nick :$line"
} |
(Written in a quite generic form, you'll have to adapt the parameters for mysqlsel and such) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Mon Apr 21, 2008 5:28 pm Post subject: |
|
|
Great, works like a charm!
What should i use to lock people from getting answer from the bot if their not in a specified channel?
like:
<me> /notice bot search site
and bot won't answer until the person is in channel #test |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Apr 21, 2008 5:45 pm Post subject: |
|
|
| Code: | bind notc - "search *" notice:search
set dbhandling [mysqlconnect -u root -p test123 -db search]
set sqltable "test"
proc notice:search {nick uhost handle text {dest ""}} {
global dbhandling sqltable
if {$dest == ""} {set dest $::botnick}
# check if nick is on #test
if {[onchan $nick #test]} {
set site [lindex [split $text] 0]
set result [mysqlsel $dbhandling "SELECT url FROM $sqltable WHERE site='$site' LIMIT 1" -list]
foreach line $result {
putserv "PRIVMSG $nick :$result"
}
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Mon Apr 21, 2008 6:00 pm Post subject: |
|
|
Thanks a lot for awesome response!
I'm pretty sure this will be the place I will hang around daily to learn and help  |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Tue Apr 22, 2008 3:18 pm Post subject: |
|
|
When I search for a url is it possible to move the searched url to another table after the output of search is done?
if so, how would that be done? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 22, 2008 3:28 pm Post subject: |
|
|
Execute another query(s) which will make the move, for example:
| Code: | foreach url $results {
# after outputing the url, delete it from Table1 and insert it into Table2
mysqlexec $dbhandling "DELETE FROM Table1 WHERE URL='$url'"
mysqlexec $dbhandling "INSERT INTO Table2(URL) VALUES('$url')"
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Tue Apr 22, 2008 5:34 pm Post subject: |
|
|
Thanks a lot!
Next: I have been reading a little about event scheduler for MySQL..
Because I want a line from the table2 to move back to table1 after 12hours.
Is this something TCL handle or is it MySQL? I'm not sure |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 22, 2008 5:46 pm Post subject: |
|
|
I'm not sure if an event can be scheduled in MySQL, however it can surely be done using Tcl. You can either use timers or time binds. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
ztian299 Halfop
Joined: 19 Apr 2008 Posts: 59 Location: *.no
|
Posted: Fri Apr 25, 2008 2:44 pm Post subject: |
|
|
Hrrm, looks like it won't work like it should
It only insert into column 'site' and leaves column 'url' blank?
| Code: |
# /notice bot search
proc notice:search {nick uhost handle text {dest ""}} {
global dbhandling sqltable chan2 sqltable2
if {$dest == ""} {set dest $::botnick}
# check if nick is on #chan
if {[onchan $nick $kanal2]} {
set site [lindex [split $text] 1]
set url [lindex [split $text] 2]
# mysql...
set result [mysqlsel $dbhandling "SELECT url FROM $sqltable WHERE site='$site' LIMIT 1" -list]
foreach line $result {
foreach move $result {
mysqlexec $dbhandling "DELETE FROM $sqltable WHERE url='$url'"
mysqlexec $dbhandling "INSERT INTO $sqltable2 (site, url) VALUES ('$site', '$url')"
putserv "PRIVMSG $nick :$line"
putlog "$site searched by $nick"
putlog "$site moved $sqltable -> $sqltable2"
}
}
}
}
|
|
|
| Back to top |
|
 |
|