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.
Old posts that have not been replied to for several years.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Jul 20, 2003 9:41 am
I want the bot to ban the host of the user who parts with reason : #name of the channel>
like for example:
. . Parts Nick(~
xcavz@xxx.xxx.xxx.x ) from #channel : (#channel)
. . Chanmode : Bot sets mode +b *!*@xxx.xxx.xxx.x
but i want it to only do that ban if the user joins and parts within 7 seconds.
like this:
but if the user stays in the channel for more than 7secs before parting with reason #<channel's name> then the bot doesn't ban.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Sun Jul 20, 2003 11:45 am
use a part bind and getchanjoin. (doc/tcl-commands.doc for details)
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Jul 20, 2003 12:29 pm
kay, but would the getchanjoin read within a particular interval of time ?
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Sun Jul 20, 2003 12:53 pm
Sir_Fz wrote: kay, but would the getchanjoin read within a particular interval of time ?
What do you mean? If you'd read tcl-commands.doc you'd know what getchanjoin does...just compare the time returned with the current time minus 7 seconds and you know if you should ban or not.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Jul 20, 2003 5:39 pm
getchanjoin <nickname> <channel>
Returns: timestamp (unixtime format) of when the specified nickname
joined the channel
Module: irc
how do I use it ? and explain more to me how the time is measured plz.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Sun Jul 20, 2003 7:49 pm
Sir_Fz wrote: getchanjoin <nickname> <channel>
Returns: timestamp (unixtime format) of when the specified nickname
joined the channel
Module: irc
how do I use it ? and explain more to me how the time is measured plz.
Use getchanjoin in the proc triggered by the part bind to find out when the person parting joined... if that time >= (current time - 7) ban the user.
'unixtime' is the number of seconds since 00:00:00 01/01/1970
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Jul 21, 2003 2:14 am
what it would be like ??
if {[getchanjoin * $chan] >= -7} {.... ??
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Jul 21, 2003 10:03 am
Sir_Fz wrote: what it would be like ??
if {[getchanjoin * $chan] >= -7} {.... ??
No. Not unless your current time is 23:59:53 12/31/1969 and the nick of your parter is '*'.
Fetch the current time in seconds since 1970 using 'clock seconds' or 'unixtime'.
Here's some code to get you started:
Code: Select all
bind part - "#test *" partchk
proc partchk {n u h c a} {
# was the part reason == the channel name?
if {[string eq -nocase $c $a]} {
# did this luser stay for less than 7 seconds?
if {[getchanjoin $n $c]>=[expr {[clock seconds]-7}]} {
# yup...ban *!*@[lindex [split $u @] end] or whatever
}
}
}
Last edited by
user on Tue Jul 22, 2003 5:50 am, edited 1 time in total.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Jul 21, 2003 3:49 pm
[snip]
# did this luser stay for more than 7 seconds?
if {[getchanjoin $n $c]>=[expr {[clock seconds]-7}]}
[snip]
this will kick the user if he stays for mor than 7secs or it wil ban the uhost if he parts after he join in these 7secs ?
also if i do
bind part - "*!~*@*" <proc-name> then it will check only for users with ~ in their ident ?
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Tue Jul 22, 2003 3:53 am
yes.
yes... although the right syntax would be bind part - "* *~*@*" <procname>
Elen sila lúmenn' omentielvo
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Jul 22, 2003 5:49 am
Sir_Fz wrote: [snip]... for more than 7 ...[/snip]
this will kick the user if he stays for mor than 7secs or it wil ban the uhost if he parts after he join in these 7secs ?
Sorry about adding misleading comments
(I meant "for LESS than 7 seconds").
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Jul 22, 2003 7:01 am
okay, thanx
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Jul 22, 2003 3:31 pm
using:
Code: Select all
bind part - "* *~*@*" partchk
proc partchk {nick uhost hand chan rsn} {
if {[string eq -nocase $chan $rsn} {
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-4}]} {
set ban "*!~*@[lindex [split $uhost @] end]"
newban $ban $::botnick "spammer." 0
}
}
}
didn't work, any reasons why ?
Note : the user joined and parted with reason "$chan" within 2 or 3 seconds.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jul 23, 2003 4:52 am
anybody ? why didn't it work ?
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Wed Jul 23, 2003 5:02 am
If you'd read your error messages you'd know. (missing close bracket in the string eq-line.)