Hi, I have the below code that posts if a user leaves or joins a channel. The only problem is that it works fine on a join, but on a part it does nothing. Any ideas?
A part bind passes 5 arguments to the proc it calls. You only had 4. Always check the syntax in tcl-commands.html before you use a bind that you are unfamiliar with. It is also always a good idea to keep track of what's going on in the partyline while a new script is being executed, I'm pretty sure you would have seen an error telling you what was wrong.
Don't forget that a PART bind triggers only for users leaving a channel and not for those quitting (SIGN bind) or those split from your server (SPLT bind).
A PART bind does NOT seem to trigger if the bot parts, unlike a JOIN bind which does trigger if the bot joins. This was news to me until I just experimented on another script I am coding.
# report.tcl
# set here the channel the bot reports joins/parts to
set vReportChan #eggtcl
bind JOIN - * pReportJoin
bind RAW - PART pReportPart
proc pReportJoin {nick uhost hand chan} {
global vReportChan
if {[botonchan $vReportChan]} {
putserv "PRIVMSG $vReportChan :\002\00303$nick joined $chan\003\002"
}
return 0
}
proc pReportPart {from keyword text} {
global vReportChan
if {[botonchan $vReportChan]} {
set nick [lindex [split $from !] 0]
set chan [string trim [lindex [split $text :] 0]]
putserv "PRIVMSG $vReportChan :\002\00304$nick parted $chan\003\002"
}
return 0
}
putlog "report.tcl loaded"
# eof
The above script has been tested and works using a RAW bind with keyword PART instead of a PART bind. As already stated, NOT for quits, splits, kicks etc.
I have still not got to the bottom of the PART bind. I have a Windrop 1.6.19 for which the PART bind does not trigger for the bot itself parting and I have an Eggdrop 1.6.19+ctcpfix for which the PART bind does trigger. The mind boggles!