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 

need help with watch.tcl from willyw

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Andika
Voice


Joined: 06 Jul 2020
Posts: 4
Location: Malaysia

PostPosted: Mon Jul 06, 2020 5:12 am    Post subject: need help with watch.tcl from willyw Reply with quote

Hi there
This tcl running smoothly. Thanks To willyw.

visit here: http://forum.egghelp.org/viewtopic.php?t=19934
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
}
#########

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 Smile
-------------------------------------
GuardianAngel
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 06, 2020 11:28 am    Post subject: Re: need help with watch.tcl from willyw Reply with quote

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. Smile

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. Smile 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 !
Back to top
View user's profile Send private message
Andika
Voice


Joined: 06 Jul 2020
Posts: 4
Location: Malaysia

PostPosted: Tue Jul 07, 2020 5:08 am    Post subject: need help with watch.tcl from willyw Reply with quote

Thanks willyw Really Appreciate That Smile

Hope Someone Will Help Me Smile

-------------------------------
GuardianAngel
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jul 07, 2020 12:12 pm    Post subject: Re: need help with watch.tcl from willyw Reply with quote

Find proc rpl_logon.
Replace it with this:


Code:

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

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

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
Andika
Voice


Joined: 06 Jul 2020
Posts: 4
Location: Malaysia

PostPosted: Wed Jul 08, 2020 11:35 am    Post subject: Reply with quote

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. Very Happy Very Happy Very Happy

Code:
[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 Smile

---------------------------------------------
GuardianAngel
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Jul 08, 2020 12:08 pm    Post subject: Reply with quote

Andika wrote:

...
I've tested it and it works well
...


and THAT is good to hear. ( That makes MY day. Smile )
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 !
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 -> Script Requests 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