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 

TCL Quit status notifier

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


Joined: 21 Aug 2018
Posts: 6

PostPosted: Tue Aug 21, 2018 8:30 am    Post subject: TCL Quit status notifier Reply with quote

Hi guys,
I am looking for tcl script to notify (with private msg to nick) quit events of certain people on channel.

I am following my friend az

Ex. on channel
* Quits: @az (az@slackware.com) (Ping Timeout)

Ex. in pvt

Egg > hi, doni. az quit right now. Reason: Ping Timeout

Someone help me?
Thanks a lot!
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 975

PostPosted: Tue Aug 21, 2018 5:31 pm    Post subject: Re: TCL Quit status notifier Reply with quote

Experiment with this.

You will have to edit three lines.

Code:


# August 21, 2018

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

# I am looking for tcl script to notify (with private msg to nick) quit events of certain people on channel.
#
# I am following my friend az
#
# Ex. on channel
# * Quits: @az (az@slackware.com) (Ping Timeout)
#
# Ex. in pvt
#
# Egg > hi, doni. az quit right now. Reason: Ping Timeout

###########################################


# set the list of nicks to watch for quits
set nicks2watch "foo moo who"

# set the nick to notify via pm
set pm_nick "your_nick"

# set the channel to watch
bind sign - "#temptest *" do_quit_notify


#####
proc do_quit_notify {nick uhost handle chan reason} {
global nicks2watch pm_nick

        if {[lsearch -nocase [split $nicks2watch] [split $nick] ] != -1 } {
                putserv "privmsg $pm_nick :Hi $pm_nick. $nick quit right now. Reason: $reason"
        }
}
####




Only tested twice. Worked for me. Smile

I hope this helps.
_________________
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
doni
Voice


Joined: 21 Aug 2018
Posts: 6

PostPosted: Tue Aug 21, 2018 8:21 pm    Post subject: Re: TCL Quit status notifier Reply with quote

[08:48] Tcl error [do_quit_notify]: bad search mode "-nocase": must be -exact, - glob, or -regexp

i am using -exact and it's work! what are the differences between exact, glob or regexp?

"#temptest *" --> why *?
THANKS!
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 975

PostPosted: Tue Aug 21, 2018 10:23 pm    Post subject: Re: TCL Quit status notifier Reply with quote

doni wrote:

...
[08:48] Tcl error [do_quit_notify]: bad search mode "-nocase": must be -exact, - glob, or -regexp

i am using -exact and it's work! what are the differences between exact, glob or regexp?


The main page for TCL commands is:
http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm

Once there, you can find the lsearch command:
http://www.tcl.tk/man/tcl8.6/TclCmd/lsearch.htm

and all those things are explained there.

I don't even try to remember all that stuff - I just remember (I have it bookmarked) where and how to look it up when I need it. Wink


Quote:

"#temptest *" --> why *?


For this one, go here:
http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search or scroll down to:
bind sign
and see this in context:
".... Wildcards can be used in the mask, which is matched against '#channel nick!user@host'. "

In other words, I put an asterisk there so that the bind would trigger on every quit. I thought that was what you wanted / needed.
If you WANT to limit it to triggering only on certain hostmasks, you can do it right there. Up to you. Hack at it. Experiment. Have fun. Smile

Tip: When editing bind lines, a simple .rehash is often not sufficient. You may get unexpected results. While there are other ways to handle it, the simple, easiest way is: When editing bind lines, do a .restart to effect the change.
If you really want more explanation on why, say so and we'll go over it.
Smile


As for why you got that error ... about the -nocase switch I used with the lsearch command - I wonder what version of TCL you have.
I wonder if it is somehow a very old version....

In partyline, do: .status
and the version of TCL will be on one of the lines in the report returned.

I hope this helped.
_________________
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
Ezekiel
Voice


Joined: 16 Dec 2014
Posts: 17

PostPosted: Wed Aug 22, 2018 2:54 am    Post subject: Reply with quote

it seems you use an older TCL version, try replacing the line:
Quote:
if {[lsearch -nocase [split $nicks2watch] [split $nick] ] != -1 } {

with this one:
Quote:
if {[lsearch [string tolower [split $nicks2watch]] [string tolower [split $nick]] ] != -1 } {

_________________
http://blacktools.tclscripts.net - download BlackTools last version


Last edited by Ezekiel on Thu Aug 23, 2018 12:57 am; edited 1 time in total
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3516
Location: Top Secret

PostPosted: Wed Aug 22, 2018 7:36 am    Post subject: Reply with quote

The -nocase argument was introduced in version 8.5, so most likely he's using 8.4 (if not lower).

doni you should consider upgrading the TCL library because everyone tends to use stuff that can be found in newer versions of the library.
_________________
You may say anything about me, but at least don't misspell my name. xD
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 975

PostPosted: Wed Aug 22, 2018 7:57 am    Post subject: Reply with quote

caesar wrote:
The -nocase argument was introduced in version 8.5, so most likely he's using 8.4 (if not lower).


I was unsure of this, and didn't take time to go try to look it up. Thank you.

As a matter of fact, it is easy to lose track of time ... I don't remember how long ago it has been when version 8.4 was typical. Time flies - it's getting to be a while now.

doni : What Ezekiel said, is what I would do too.

You can read about what the command that he uses does, here:
http://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M44
_________________
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
doni
Voice


Joined: 21 Aug 2018
Posts: 6

PostPosted: Sun Aug 26, 2018 5:45 am    Post subject: Reply with quote

Guys, You are amazing!!! Thanks a lot!!!
Just last question...

In the same TCL:
- how can i set for multiple users in the same tcl?
ex. az want check quits of some nicks in #ipv6 channel
john want check quits of different nicks in #tcl channel

- like quit, how can eggdrop catch full NOTICES from channel to send (paste) to user?

ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?

Thanks <3
Back to top
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 975

PostPosted: Sun Aug 26, 2018 11:30 am    Post subject: Reply with quote

doni wrote:
Guys, You are amazing!!! Thanks a lot!!!



You're welcome.

Quote:

Just last question...

In the same TCL:
- how can i set for multiple users in the same tcl?
ex. az want check quits of some nicks in #ipv6 channel
john want check quits of different nicks in #tcl channel


You said "multiple users", yet your examples are ALSO multi-channel. Smile

Either one of those complicates it.

I'd have to think about it a while, before deciding just how it would be best to go about it.

I'm not sure at all if or when I'll get to it. Perhaps somebody else here will want to jump in.

If they do - even if I do - don't expect it to be a simple couple lines of code to modify what you have now. It will most likely be all new.

Quote:

- like quit, how can eggdrop catch full NOTICES from channel to send (paste) to user?


You'd just asked for "to user". That's singular. Are you going to later ask for it to be multi-user? Smile

Quote:

ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?


I don't get it. Perhaps that is because I get notices in channel, in my client. But why would you want to repeat what was just said, just using a different method? Especially why would you want to take what was said in a notice, and repeat it in the open channel?
There must be something that I'm not understanding....
_________________
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
doni
Voice


Joined: 21 Aug 2018
Posts: 6

PostPosted: Sun Aug 26, 2018 11:42 am    Post subject: Reply with quote

Quote:

ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?

Quote:

I don't get it. Perhaps that is because I get notices in channel, in my client. But why would you want to repeat what was just said, just using a different method? Especially why would you want to take what was said in a notice, and repeat it in the open channel?
There must be something that I'm not understanding....

I need to catch from channel &SERVERS notices of join and leave of irc servers (netsplit) and paste it in another channel as text message
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