This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Persist watch list in willyw's nicks watch script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Persist watch list in willyw's nicks watch script

Post by Arnold_X-P »

http://forum.egghelp.org/viewtopic.php? ... t=addwatch

this tcl is very interesting but it has flaws only in its way of keeping the nicknames
in fact he does not keep them why when I begin again to the bot ready happiness or aggregate nicknames are not.

Code: Select all

 
# April 20, 2015

# http://forum.egghelp.org/viewtopic.php?t=19934

# the poster is asking to make something similar to mIRC's built in "notify" list
# mIRC uses the IRC server's /watch command   or the  /monitor command


# Usage:
# To temporarily add a nick to the watch list:
# !addwatch <nick>

# To temporarily remove a nick from the watch list:
# !remwatch <nick>

# To display the current watch list:
# !watchlist



# You must create a plain text file, with one nick per line
# This file will be read by the bot upon .restart and the nicks in it
# will be added to the watch list held by the IRC server for this session.

#set the path/filename of file that holds the nicks to watch  (Required)
set nicks_watch_file "scripts/added/use_irc_watch/nicks_watch_file.txt"

#set channel where you can experiment and demonstrate this script  (Required - and bot must be on this channel)
set your_demo_chan #eggdrop




##########################################################################
##########################################################################
bind pub - "!addwatch" add_to_watchlist
bind pub - "!remwatch" remove_from_watchlist
bind pub - "!watchlist" get_watch_stats

bind raw - 600 rpl_logon
bind raw - 601 rpl_logoff
bind raw - 606 rpl_watchlist

#Reference : https://www.alien.net.au/irc/irc2numerics.html



#########  to read the nicks to watch, and send them to the IRC server
proc send_watch_command {nicks_watch_file} {

        if {![file exists $nicks_watch_file]} {
                putlog " "
                putlog "$nicks_watch_file not found !"
                putlog " "
                return 0
        }


        set fp [open $nicks_watch_file "r"]
        set data [read -nonewline $fp]
        close $fp

        set lines [split $data "\n"]

        foreach n $lines {
                puthelp "watch +$n"
        }

        putlog "Added these nicks to watch list on IRC server : $lines"
}




proc rpl_logon {from key text } {
global your_demo_chan
        #putserv "privmsg $your_demo_chan :$from       $key        $text"
        putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged on "

        putserv "invite [lindex [split $text] 1] $your_demo_chan "
}



proc rpl_logoff {from key text} {
global your_demo_chan
        #putserv "privmsg $your_demo_chan :$from      $key         $text"
        putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged off"
}

proc rpl_watchlist {from key text} {
global your_demo_chan
        putserv "privmsg $your_demo_chan :Watch list of nicks is currently: [lindex [split $text :] 1]"
}




proc add_to_watchlist {nick uhost handle chan text} {
        putserv "watch +[lindex [split $text] 0 ]"
        putserv "privmsg $chan :[lindex [split $text] 0 ] temporarily added to watch list"
        putserv "privmsg $chan :Edit the watch list file, to make it permanent for next restart of bot"
}

proc remove_from_watchlist {nick uhost handle chan text} {
        putserv "watch -[lindex [split $text] 0 ]"
        putserv "privmsg $chan :[lindex [split $text] 0 ] temporarily removed from watch list"
        putserv "privmsg $chan :Edit the watch list file, to permanently remove for next restart of bot"
}


proc get_watch_stats {nick uhost handle chan text} {
        putserv "watch stat"
}

#########  read the nicks to watch, and send them to the IRC server
bind evnt - init-server do_watch_command_wrap

proc do_watch_command_wrap {type} {
global nicks_watch_file
        send_watch_command $nicks_watch_file
}
######### 
please someone who solves this detail that the txt does not create and does not keep the list


and if it is possible to change this route
set nicks_watch_file "scripts/added/use_irc_watch/nicks_watch_file.txt"
to set nicks_watch_file "scripts/nicks_watch_file.txt"

thanks
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: help help watch tcl for willyw

Post by willyw »

Hello,
Arnold_X-P wrote: ...

this tcl is very interesting but it has flaws

I found my old copy of this script, and loaded it.
A quick test, and it works as designed.
.. only in its way of keeping the nicknames...
The script doesn't keep nicknames.
It says so:

Code: Select all

# To temporarily add a nick to the watch list:  ....
You keep them, by editing a text file.
...in fact he does not keep them why when I begin again to the bot ready happiness or aggregate nicknames are not.
When you .restart the bot, in the text that you see in the partyline, as the bot logs in, etc., you will see either:
scripts/added/use_irc_watch/nicks_watch_file.txt not found !
or
Added these nicks to watch list on IRC server : someNick anotherNick
please someone who solves this detail that the txt does not create and does not keep the list
This script does not create the text file list. It only reads it. You create it, with your text editor.
and if it is possible to change this route
set nicks_watch_file "scripts/added/use_irc_watch/nicks_watch_file.txt"
to set nicks_watch_file "scripts/nicks_watch_file.txt"
Yes, it is possible. It says so in a comment. It says it is required.
Edit it.

I suspect this is what your problem is. In that this line is not pointing to the text file that is the list of nicks.
Or, if it is, then the text file is empty.

Let me know if you have it working now.
If not, let me know what network you are using it on.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: help help watch tcl for willyw

Post by Arnold_X-P »

an excellent tcl is someone please
it would be ideal that is not in temporary form and that is in fixed form when he adds nicknames to be notified
and that the current route scripts/added/use_irc_watch/nicks_watch_file.txt
be modified to something shorter how for example scripts/nicks_watch_file.txt

some friend please who helps in this wonderful tcl to be perfected
help please :)
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Re: help help watch tcl for willyw

Post by Get_A_Fix »

Arnold_X-P wrote:it would be ideal that is not in temporary form
This is pretty much what the script does. You have to realise that with the /watch command, it's temporary via the server, so it's temporary via the script. When the user who is added quits from the network, the watch list entry for them is cleared.

It also lets you add whatever path you wish, as you asked.

Just edit

Code: Select all

#set the path/filename of file that holds the nicks to watch  (Required)
set nicks_watch_file "scripts/added/use_irc_watch/nicks_watch_file.txt"
to reflect the exact path you wish

Code: Select all

#set the path/filename of file that holds the nicks to watch  (Required)
set nicks_watch_file "./scripts/nicks_watch_file.txt"
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.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: help help watch tcl for willyw

Post by Arnold_X-P »

it does not work
I extinguish the bot and again I initiate it and its list does not keep it
the temporary list can be modified
to a permanent list is possible

that the list of added nicknames is permanent.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Re: help help watch tcl for willyw

Post by Get_A_Fix »

Arnold_X-P wrote:it does not work
I extinguish the bot and again I initiate it and its list does not keep it
the temporary list can be modified
to a permanent list is possible

that the list of added nicknames is permanent.
You were already told why this happens. The file is NOT created by this script, YOU must create it and then add nicknames you want to have permanent.
The script even mentions this:

Code: Select all

proc add_to_watchlist {nick uhost handle chan text} {
        putserv "watch +[lindex [split $text] 0 ]"
        putserv "privmsg $chan :[lindex [split $text] 0 ] temporarily added to watch list"
        putserv "privmsg $chan :Edit the watch list file, to make it permanent for next restart of bot"
} 
If you use the !addwatch command, this will add a temp nick to the file (if the file exists), for permanent add the nicknames to the file yourself, using a text editor.

Yes, this script could be modified to use !addwatch to add a perm nick list, but if willyw has replied and not edited/updated the code, then it must be released as is; which means you would have to edit/modify the code yourself.
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.
User avatar
Andika
Voice
Posts: 4
Joined: Mon Jul 06, 2020 4:58 am
Location: Malaysia

Post by Andika »

This tcl is Very usefull works very find on ur server. Thanks willyw

Just Changed it to this.

Code: Select all

#set the path/filename of file that holds the nicks to watch  (Required)
set nicks_watch_file "scripts/nick.txt"


And make nick.txt on script folder :D
it's Work Perfectly
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Andika wrote:This tcl is Very usefull ...
That's good to hear.

You're welcome.

:)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Post Reply