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.

Greet script for selected users

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
q
quantum0726
Voice
Posts: 9
Joined: Fri Mar 03, 2006 9:34 pm

Greet script for selected users

Post by quantum0726 »

Hi, I'm not sure if this is something that can be set directly in eggdrop or if it requires a sep. script (so feel free to move this to another forum if appropriate).

I'm looking for a way to have my bot greet only users with nicks following a certain pattern, e.g. Guest*. I found a greet script, but it looks like it'll greet every user:

Code: Select all

set welc(msg) "hi %nick, welcome!" 
set welc(chan) "#channel" 
set welc(type) "1" 

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

set welctxt $welc(msg) 
regsub -all "%nick" $welctxt "$nick" welctxt 
regsub -all "%chan" $welctxt "$chan" welctxt 
switch $welc(type) { 
1 { puthelp "NOTICE $nick :$welctxt" } 
2 { puthelp "PRIVMSG $nick :$welctxt" } 
} 
} 
putlog "Channel Greeting - Generated by http://www.egginfo.org - Frostbyte" 
Can I modify this script or can you recommend any script to do this. I'm guessing just a if clause for $nick would work, but I don't know how to use wildcards/regex in tcl.

Thanks much!
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Maybe alter this script

Code: Select all

set badnicks [list "*Guest*"] 

bind join - * ban:bnick 
bind nick - * ban:bnick 

proc ban:bnick {nick uhost hand chan {nn ""}} { 
global badnicks 
set bbanmask "*$nick*!*@*" 
if {$nn == ""} { set nn $nick } 
if {![isbotnick $nick]} { 
  foreach badnick $badnicks { 
   if {[string match -nocase  $badnick $nn]} { 
    putserv "MODE $chan +b $bbanmask" 
    putserv "KICK $chan $nick :Guest Nicks not allowed." 
    break 
   } 
  } 
 } 
}
q
quantum0726
Voice
Posts: 9
Joined: Fri Mar 03, 2006 9:34 pm

Post by quantum0726 »

Thanks cache! I modified the script a bit and it's working well.

Code: Select all

set guestnicks [list "*Guest*"] 

bind join - * greet:gnick

proc greet:gnick {nick uhost hand chan {nn ""}} { 
global guestnicks
if {$nn == ""} { set nn $nick } 
if {![isbotnick $nick]} { 
  foreach guestnick $guestnicks { 
   if {[string match -nocase  $guestnick $nn]} { 
    # wait a bit first, then send greeting
    after 30000
    putserv "PRIVMSG $chan :Hi $nick!"
    break 
   } 
  } 
 } 
}
Post Reply