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 

Anto Bot

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


Joined: 07 Jul 2012
Posts: 26

PostPosted: Wed Sep 11, 2013 12:23 am    Post subject: Anto Bot Reply with quote

I got this code somewhere.. credits to him, I try to make improvisation.. but failed.. Usually, human will always on on daily.. only small amount of people are online after 1 AM. But not spammer or bot. So, the idea is, I want make some Captcha or question on after 1 AM, wish that general spam bot can not answer and get kick ban. But its not success.. something wrong.. the answer is always wrong.. where is the faulty code ?

Code:
setudef flag question

bind time - "42 23 * * *" coba:hidupkan
bind time - "06 20 * * *" coba:matikan

proc coba:hidupkan {} {
channel set #bawel +question
putserv "PRIVMSG #bawel : Anti Bot Enable"
}

proc coba:matikan {} {
channel set #bawel -question
putserv "PRIVMSG #bawel : Anti Bot Disabled"
}


namespace eval question {

   bind join - *             [namespace current]::onjoin
   bind msgm - ".jawab *"      [namespace current]::answer


   namespace eval variable {
      variable bantime 1440
      variable tag "Banned:"
      variable kickreason "Possible bot"
      variable channel "#bawel"
   }

   proc onjoin {nickname hostname handle channel} {
      global botnick timers answer
      if {$nickname == "Rewel"} { return }
      if {[channel get $channel question] == 1} {
         if {![isbotnick $nickname] && ![info exists timers($hostname)]} {
            set num1 [rand 9]
            set num2 [rand 9]
            set q [expr $num1 + $num2]

            set answer($hostname) $q
            set timers($hostname) [timer 2 [list ::question::noanswer $hostname]]

            putserv "PRIVMSG $nickname :I have a question, please answer with: .jawab <number>"
            putserv "PRIVMSG $nickname :$num1 + $num2 = ?"

         }
      }
   }





   proc noanswer {hostname} {
      global botnick timers answer
      if {[info exists timers($hostname)]} {
         set channel $::question::variable::channel
         set bantime $::question::variable::bantime

         foreach user [chanlist $channel] {
            if {[string match "$hostname" "[string trim [getchanhost $user $channel] "~"]"]} {
               set victim [string tolower $user]
            }
         }
         if {[info exists victim]} {
            if {[botisop $channel]} {
               putserv "mode $channel +b *!*[string trim $hostname "~"]"
               putserv "kick $channel $victim :$::question::variable::tag $::question::variable::kickreason"
               putserv "PRIVMSG $victim :Kamu tidak menjawab pertanyaan saya!"
            }
            newchanban $channel *!*[string trim $hostname "~"] question "$::question::variable::kickreason" $bantime
         }
         unset timers($hostname)
         unset answer($hostname)
      }
   }






   proc answer {nickname hostname handle arguments} {
      global botnick timers answer
      if {[info exists timers($hostname)]} {

         set channel $::question::variable::channel
         set bantime $::question::variable::bantime
         set correctanswer [lindex $arguments 1]

         if {[string match $correctanswer $answer($hostname)] != 1} {
            if {[botisop $channel]} {
               putserv "mode $channel +b *!*[string trim $hostname "~"]"
               putserv "kick $channel $nickname :$::question::variable::tag $::question::variable::kickreason"
            }
            killtimer $timers($hostname)
            newchanban $channel *!*[string trim $hostname "~"] question "$::question::variable::kickreason" $bantime
            putserv "PRIVMSG $nickname :Jawaban salah!"
         } else {
            killtimer $timers($hostname)
            putserv "PRIVMSG $nickname :Jawaban benar!"
            putquick "MODE $channel +v $nickname"
         }
         unset timers($hostname)
         unset answer($hostname)
      }
   }
}
putlog "Antibot Loaded"


Thanks in advance
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 -> 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