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 

Make this channel specific?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
DJmart
Voice


Joined: 08 Mar 2006
Posts: 21

PostPosted: Sat Apr 01, 2006 12:49 pm    Post subject: Make this channel specific? Reply with quote

Code:
set badnicks [list "*[censored]*" "*dyn_*" "*dyn_user*"]

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

proc ban:bnick {nick uhost hand chan {nn ""}} {
global badnicks
set bbanmask "*!*@[lindex [split $uhost @] 1]"
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 :Please Identify, before you enter this channel, and or make sure you auto-ident when you disconnect This ban will expire in 15 Minutes ."
    break
   }
  }
 }
}

Thats the code, yet, I want this to be for user defined channels such as

Channels: "#lamer" "#Smile"

Thanks!
Back to top
View user's profile Send private message Send e-mail AIM Address
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sat Apr 01, 2006 4:18 pm    Post subject: Reply with quote

such a feature has been posted like 30 times.

Edit: http://forum.egghelp.org/search.php
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...


Last edited by De Kus on Sun Apr 02, 2006 8:40 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
DJmart
Voice


Joined: 08 Mar 2006
Posts: 21

PostPosted: Sat Apr 01, 2006 7:52 pm    Post subject: Reply with quote

could you post it?

I am an uber noob with TCL
Back to top
View user's profile Send private message Send e-mail AIM Address
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Apr 02, 2006 10:11 am    Post subject: Reply with quote

You can create a list of channels
Code:
set bnchans {#chan1 #chan2}

and use
Code:
if {[lsearch -exact $bnchans $chan] == -1} {return 0}

inside your proc(s). Here ofcourse, bnchans should be globalized inside the proc and you would want to make the channels lower-case since [lsearch] is case-sensitive.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DJmart
Voice


Joined: 08 Mar 2006
Posts: 21

PostPosted: Sun Apr 02, 2006 11:15 am    Post subject: Reply with quote

Code:
set badnicks [list "*[censored]*" "*dyn_*" "*dyn_user*"]
set bnchans {#aite}

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

proc ban:bnick {nick uhost hand chan {nn ""}} {
if {[lsearch -exact $bnchans $chan] == -1} {return 0}
global badnicks
set bbanmask "*!*@[lindex [split $uhost @] 1]"
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 :Please Identify, before you enter this channel, and or make sure you auto-ident when you disconnect This ban will expire in 15 Minutes ."
    break
   }
  }
 }
}


I get an error, is there something I did wrong?

Code:
[08:12] Tcl error [ban:bnick]: can't read "bnchans": no such variable
Back to top
View user's profile Send private message Send e-mail AIM Address
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Apr 02, 2006 12:02 pm    Post subject: Reply with quote

Sir_Fz wrote:
you would want to make the channels lower-case since [lsearch] is case-sensitive.

I'd recommned using the same capitalition as the bot knows them (like shown in .status).


DJmart wrote:
I get an error, is there something I did wrong?

Code:
[08:12] Tcl error [ban:bnick]: can't read "bnchans": no such variable

Read this again:
Sir_Fz wrote:
bnchans should be globalized inside the proc

that means you either add it to the global line or add :: behind the $ for each call to that var within a proc.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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