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 

Greet script for selected users

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


Joined: 03 Mar 2006
Posts: 9

PostPosted: Sun Mar 05, 2006 4:25 am    Post subject: Greet script for selected users Reply with quote

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:
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!
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sun Mar 05, 2006 11:41 pm    Post subject: Reply with quote

Maybe alter this script

Code:

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
   }
  }
 }
}
Back to top
View user's profile Send private message
quantum0726
Voice


Joined: 03 Mar 2006
Posts: 9

PostPosted: Tue Mar 07, 2006 5:27 pm    Post subject: Reply with quote

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

Code:

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
   }
  }
 }
}
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