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.

[SOLVED] Chan. Notice:not to send notice to a kick/ban usr

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
p
panasonic
Voice
Posts: 25
Joined: Sat Sep 15, 2007 5:27 am

[SOLVED] Chan. Notice:not to send notice to a kick/ban usr

Post by panasonic »

Code: Select all

set welc(msg1) "Message in 1st line" 
set welc(msg2) "Message in 2nd line"   
set welc(chan) "#MyChannel"   
set welc(type) "1"   
  
bind join - #MyChannel* givewelcome   
proc givewelcome {nick uhost hand chan} {   
global welc   
  
set welctxt1 $welc(msg1) 
set welctxt2 $welc(msg2)   
regsub -all "%nick" $welctxt1 "$nick" welctxt1 
regsub -all "%nick" $welctxt2 "$nick" welctxt2   
regsub -all "%chan" $welctxt1 "$chan" welctxt1 
regsub -all "%chan" $welctxt2 "$chan" welctxt2 
switch $welc(type) {   
1 { 
puthelp "NOTICE $nick :$welctxt1" 
puthelp "NOTICE $nick :$welctxt2" 
}   
2 { 
puthelp "PRIVMSG $nick :$welctxt1" 
puthelp "PRIVMSG $nick :$welctxt2" 
}   
}   
}   
putlog "Channel Greeting - Generated by http://www.egginfo.org - Frostbyte"
Hi!
I do have a simple channel notice generated as above.
but the problem is, if there is a mass clones (which will then been kicked and banned from channel), the bot still sending notice to them eventhough they have been kicked out from channel

How to modify the script so the bot won't send notices to those who have been kicked out of channel
I found that my bot will Excess Flood by sending notices non-stop to them...

thanks in advanced
Last edited by panasonic on Mon Nov 12, 2007 4:51 pm, edited 2 times in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

One iea might be to use timers (utimer) to delay the message a few seconds, and do a simple check wether the target is still inside the channel (onchan).

See doc/tcl-commands.doc for syntaxes.
NML_375
p
panasonic
Voice
Posts: 25
Joined: Sat Sep 15, 2007 5:27 am

Post by panasonic »

sorry sir, i got this from web generator
anyone mind to help me to modify it coz im just a user :?
p
panasonic
Voice
Posts: 25
Joined: Sat Sep 15, 2007 5:27 am

Post by panasonic »

ok, there is slight modification to utimer and the timers is now working
but i still have problem with onchan (to make sure that the bot didnt send the notice/messages to any kick/banned user)

here is the codes:

Code: Select all

set welc(msg1) "1st line message"
set welc(msg2) "2nd line message"
set welc(chan) "#MyChannel"
set welc(type) "1"

bind join - #MyChannel* givewelcome
proc givewelcome {nick uhost hand chan} {
  global welc

  set welctxt1 $welc(msg1)
  set welctxt2 $welc(msg2)
  regsub -all "%nick" $welctxt1 "$nick" welctxt1
  regsub -all "%nick" $welctxt2 "$nick" welctxt2
  regsub -all "%chan" $welctxt1 "$chan" welctxt1
  regsub -all "%chan" $welctxt2 "$chan" welctxt2
  switch $welc(type) {
    if { [onchan $nick $chan] }
    1 {
      utimer 10 [puthelp "NOTICE $nick :$welctxt1"]
      utimer 10 [puthelp "NOTICE $nick :$welctxt2"]
    }
    2 {
      utimer 10 [puthelp "PRIVMSG $nick :$welctxt1"]
      utimer 10 [puthelp "PRIVMSG $nick :$welctxt2"]
    }
  }
}
putlog "Channel Greeting - Generated by http://www.egginfo.org - Frostbyte"
the bot is still sending messages to a kick/banned user
please help me to check the codes

thanks in advanced!
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

The problem is that you dont check if the user is STILL on the channel AFTER the 10 seconds.

Code: Select all

set welc(msg1) "1st line message"
set welc(msg2) "2nd line message"
set welc(chan) "#MyChannel"
set welc(type) "1"

bind join - #MyChannel* welcome:join
proc welcome:join {nick uhost hand chan} {
  global welc
  set welctxt1 $welc(msg1)
  set welctxt2 $welc(msg2)
  regsub -all "%nick" $welctxt1 "$nick" welctxt1
  regsub -all "%nick" $welctxt2 "$nick" welctxt2
  regsub -all "%chan" $welctxt1 "$chan" welctxt1
  regsub -all "%chan" $welctxt2 "$chan" welctxt2
  utimer 10 [list welcome:sendmsg $nick $chan $welc(type) $welctxt1]
  utimer 10 [list welcome:sendmsg $nick $chan $welc(type) $welctxt2]
}

proc welcome:sendmsg {nick chan type text} {
 if {![onchan $nick $chan]} { return }
 if {$type == "1"} {
  puthelp "NOTICE $nick :$text"
 } elseif {$type == "2"} {
  puthelp "PRIVMSG $nick :$text"
 }
}
putlog "Channel Greeting - Generated by http://www.egginfo.org - Frostbyte" 
Not tested - should work...
r0t3n @ #r0t3n @ Quakenet
p
panasonic
Voice
Posts: 25
Joined: Sat Sep 15, 2007 5:27 am

Post by panasonic »

thanks a lot, Tosser^^
the bot is now able to perform delay time before sending msg to user and no longer sending msg to a kicked/banned user
since the code has changed, i have to learn it and try to understand it again

thank you so much :)
Post Reply