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 

Persist watch list in willyw's nicks watch script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Thu Aug 18, 2016 11:55 pm    Post subject: Persist watch list in willyw's nicks watch script Reply with quote

http://forum.egghelp.org/viewtopic.php?t=19934&highlight=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:
 
# 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
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Aug 19, 2016 11:48 pm    Post subject: Re: help help watch tcl for willyw Reply with quote

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.

Quote:

.. only in its way of keeping the nicknames...


The script doesn't keep nicknames.
It says so:
Code:

# To temporarily add a nick to the watch list:  ....


You keep them, by editing a text file.

Quote:

...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:
Quote:

scripts/added/use_irc_watch/nicks_watch_file.txt not found !

or
Quote:

Added these nicks to watch list on IRC server : someNick anotherNick


Quote:

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.

Quote:

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 !
Back to top
View user's profile Send private message
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Thu Oct 13, 2016 9:27 pm    Post subject: Re: help help watch tcl for willyw Reply with quote

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 Smile
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Fri Oct 14, 2016 10:46 pm    Post subject: Re: help help watch tcl for willyw Reply with quote

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:

#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:

#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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Oct 16, 2016 12:22 pm    Post subject: Re: help help watch tcl for willyw Reply with quote

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.
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sun Oct 16, 2016 6:56 pm    Post subject: Re: help help watch tcl for willyw Reply with quote

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:

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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Andika
Voice


Joined: 06 Jul 2020
Posts: 4
Location: Malaysia

PostPosted: Mon Jul 06, 2020 6:10 am    Post subject: Reply with quote

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

Just Changed it to this.


Code:
#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 Very Happy
it's Work Perfectly
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 06, 2020 10:53 am    Post subject: Reply with quote

Andika wrote:
This tcl is Very usefull ...


That's good to hear.

You're welcome.

Smile
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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