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.

Add channel to to this script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
FmX
Voice
Posts: 39
Joined: Wed Dec 06, 2006 12:42 pm

Add channel to to this script

Post by FmX »

Hello, can someone told me how to make this script to work on channels that i want:

Code: Select all

bind ctcr - VERSION version:reply 
bind join - * check:version 

proc check:version {nick uhost hand chan} { if {$nick eq $::botnick} {return}
 global cversion 
 set cversion([string tolower $nick]) 1 
 putserv "PRIVMSG $nick :\001VERSION\001" 
 utimer 15 [list no:version:reply $nick $uhost $chan] 
} 

proc version:reply {nick uhost hand dest kw arg} { 
 global cversion 
 if {[info exists cversion([string tolower $nick])]} { 
  unset cversion([string tolower $nick]) 
 } 
} 

proc no:version:reply {nick uhost chan} { 
 global cversion 
 if {[info exists cversion([string tolower $nick])] && [onchan $nick $chan]} { 
  putserv "MODE $chan +b *!*@[lindex [split $uhost @] 1]" 
  putserv "KICK $chan $nick :No CTCP version reply" 
  unset cversion([string tolower $nick]) 
  } 
} 
Thanks :)
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

If you want to use it on only one channel, just modify the bind join:

Code: Select all

bind join - "#yourchan *" check:version
If you want to use it on several channels, the better way is to add a channel setting and check if it's enabled or not for the joined channel:

Code: Select all

setudef flag vcheck
bind join - * check:version 

proc check:version {nick uhost hand chan} {
   global cversion
   if {$nick eq $::botnick} {return}
   if {![channel get $chan vcheck]} { return }
   set cversion([string tolower $nick]) 1
   putserv "PRIVMSG $nick :\001VERSION\001"
   utimer 15 [list no:version:reply $nick $uhost $chan]
}
User avatar
FmX
Voice
Posts: 39
Joined: Wed Dec 06, 2006 12:42 pm

Post by FmX »

Ok, cool thanks. But if i want to run on specific channels, here to add?
bind join - "#yourchan #test2 *" check:version
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

or/and you could use it with public command to enable/disable in channel

Syntax: !version on/off

Code: Select all


bind PUB n !version Pub:Version:Checker
 
setudef flag vcheck

proc Pub:Version:Checker {nick uhost hand chan arg} {

  switch -nocase -- [lindex [split $arg] 0] {
    on {
      if {[channel get $chan vcheck]} {
        putserv "NOTICE $nick :Version-Checker is already enabled on $chan."
      } else { 
        channel set $chan +vcheck
        putserv "NOTICE $nick :Version-Checker is now enabled on $chan."
}
    }
    off {
      if {![channel get $chan vcheck]} {
        putserv "NOTICE $nick :Version-Checker is already disabled on $chan."
      } else {
        channel set $chan -vcheck
        putserv "NOTICE $nick :Version-Checker is now disabled on $chan."
     }
    }    
  }
}



bind join - * check:version
bind ctcr - VERSION version:reply

proc check:version {nick uhost hand chan} {
   global cversion
   if {$nick eq $::botnick} {return}
   if {![channel get $chan vcheck]} { return }
   set cversion([string tolower $nick]) 1
   putserv "PRIVMSG $nick :\001VERSION\001"
   utimer 15 [list no:version:reply $nick $uhost $chan]
}


proc version:reply {nick uhost hand dest kw arg} {
 global cversion
 if {[info exists cversion([string tolower $nick])]} {
  unset cversion([string tolower $nick])
 }
}


proc no:version:reply {nick uhost chan} {
 global cversion
 if {[info exists cversion([string tolower $nick])] && [onchan $nick $chan]} {
  putserv "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
  putserv "KICK $chan $nick :No CTCP version reply"
  unset cversion([string tolower $nick])
  }
}

User avatar
aslpls
Halfop
Posts: 47
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

so this is the function of this script

Code: Select all


* Trivia (ux@Tri.via) has joined #aslpls
* aslbot sets mode: +b *!*@Tri.via
* Trivia was kicked by aslbot (No CTCP version reply)


I think it will kick all the users joining the channel :D
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

aslpls wrote:so this is the function of this script

Code: Select all


* Trivia (ux@Tri.via) has joined #aslpls
* aslbot sets mode: +b *!*@Tri.via
* Trivia was kicked by aslbot (No CTCP version reply)


I think it will kick all the users joining the channel :D
meaning u tested it and thats what happened or you just think that happens without even testing it ?
User avatar
aslpls
Halfop
Posts: 47
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

hey man simo, in this forum i am not posting a comment without testing it.

yes i've tried it. and it works.

just wondering, if a user (No CTCP version reply) .. it will kick/ban the user.

again, just wondering..

if you can explain it to me what's the point on this script to be used in this channel so that i ca n understand. i am not like you can create this kind of script and understand the flow.
User avatar
FmX
Voice
Posts: 39
Joined: Wed Dec 06, 2006 12:42 pm

Post by FmX »

Its against spam bots who join spam and leave.
They doesnt respond to version :)
User avatar
aslpls
Halfop
Posts: 47
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

yes, i understand it is for spambot..


but my bot which is Trivia bot it is not a spam bot. and still
kick/ban my bot.

how the bot should decide if this bot is a spam bot or not?
User avatar
FmX
Voice
Posts: 39
Joined: Wed Dec 06, 2006 12:42 pm

Post by FmX »

It cant, kick ban everyone who doesnt reply to version :)
Post Reply