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.

need help with watch.tcl from willyw

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Andika
Voice
Posts: 4
Joined: Mon Jul 06, 2020 4:58 am
Location: Malaysia

need help with watch.tcl from willyw

Post by Andika »

Hi there
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
}
#########
can anyone help me to add host on nick that logon/logout

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
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: need help with watch.tcl from willyw

Post by willyw »

Andika wrote: ...
can anyone help me to add host on nick that logon/logout

exp

<bot> nick ident@bla.bla.bla has logon to server
<bot> nick ident@bla.bla.bla has logout from server
First:
It has been quite some time since I did this. I'd have to re-read it just to see what all I did. :)

Next:
To get the info you want, I would want to load it and experiment with it.
It should be possible.
However, I don't know when I will have time to sit and work on it. I'm sorry.

Since I posted it in public like this, I don't mind if somebody else takes it up though. :) I would ask that whatever they do to it, they simply post it in public too, right along with the original. Here in this thread would be fine.

Hopefully somebody else will jump in here.
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
Andika
Voice
Posts: 4
Joined: Mon Jul 06, 2020 4:58 am
Location: Malaysia

need help with watch.tcl from willyw

Post by Andika »

Thanks willyw Really Appreciate That :)

Hope Someone Will Help Me :)

-------------------------------
GuardianAngel
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: need help with watch.tcl from willyw

Post by willyw »

Find proc rpl_logon.
Replace it with this:

Code: Select all

###
proc rpl_logon {from key text } {
global your_demo_chan
        #putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged on "
        set ident [lindex [split $text] 2]
        set hostmask [lindex [split $text] 3]
        putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] [join "$ident $hostmask" "@"]  has logged on "

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

Find proc rpl_logoff.
Replace it with this:

Code: Select all

###
proc rpl_logoff {from key text} {
global your_demo_chan
               #putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged off"
        set ident [lindex [split $text] 2]
        set hostmask [lindex [split $text] 3]
        putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] [join "$ident $hostmask" "@"] has logged off"

}
###

Rehash.
Test.
Test some more.

:)
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
Andika
Voice
Posts: 4
Joined: Mon Jul 06, 2020 4:58 am
Location: Malaysia

Post by Andika »

hi willyw thank you for being able to help even if you don't have time you are still willing to help. thank you very much.

I've tested it and it works well And Perfectly. you really brighten my day, thanks willyw. :D :D :D

Code: Select all

[23:22:28]+Chika : plankton ~admin@bla.bla.bla.bla.IP has logged on
[23:22:50]+Chika : plankton ~admin@bla.bla.bla.bla.IP has logged off
Thank You So MUch Sir :)

---------------------------------------------
GuardianAngel
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Andika wrote: ...
I've tested it and it works well
...
and THAT is good to hear. ( That makes MY day. :) )
Thanks for reporting back.

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