This tcl running smoothly. Thanks To willyw.
visit here: http://forum.egghelp.org/viewtopic.php?t=19934
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
}
#########
exp
<bot> nick ident@bla.bla.bla has logon to server
<bot> nick ident@bla.bla.bla has logout from server
Thank You. so much
-------------------------------------
GuardianAngel