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 

need flood protection for troll.tcl

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


Joined: 14 Jan 2012
Posts: 10

PostPosted: Wed Feb 01, 2012 3:39 pm    Post subject: need flood protection for troll.tcl Reply with quote

Here is the script, thanks if anyone can do this....

Code:
#############################################################################################################
# Troll v2.0 TCL by spithash@DALnet                                                                         #
#                                                                                                           #
# Gets troll quotes and makes people suffer!                                                                #
# Version 2.0 is way different since there's no database in the file. It fetches the quotes by a website.   #
# Also, you can ".chanset #channel +troll" to enable it.                                                    #
# I added this just in case you don't want your trolls to be available globally.                            #
#############################################################################################################
# Any official release of troll.tcl will be announced in http://forum.egghelp.org/viewtopic.php?t=17078     #
# Official troll.tcl updates will be in egghelp.org's TCL archive,                                          #
# Or here: http://bsdunix.info/spithash/troll/troll.tcl                                                     #
# (Keep it to "puthelp" cause I didn't add any flood protection yet,                                        #
# and it may cause your bot "Excess Flood" quit if it's in "putserv" or "putquick",                         #
# if someone floods the !troll trigger or if the troll quote is too long.)                                  #
#############################################################################################################
# Credits: special thanks to: username & speechles who helped me with this :)                               #
#############################################################################################################
setudef flag troll
bind pub - !troll parce
proc parce {nick uhost hand chan text} {
    if {[channel get $chan troll]} {
::http::config -urlencoding utf-8 -useragent "Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.8.1) Gecko/2006101023 Firefox/2.0"
set url [::http::geturl "http://rolloffle.churchburning.org/troll_me.php" -timeout 15000]
set data [::http::data $url]
::http::cleanup $url
regsub -all -- {\n} $data "" data;
regexp -nocase -- {<p .*?>(.*?)</p>} $data -> info
regsub -all -- {(<strong[^>]*>)|(</strong>)} $info "\002" info;
while { $info != "" } {
    puthelp "PRIVMSG $chan :[string range $info 0 419]"
    set info [string range $info 420 end]
    }
  }
}
putlog "troll.tcl v2.0 by spithash@DALnet iz up and trollin'"
# EOF
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Thu Feb 02, 2012 11:41 am    Post subject: Reply with quote

I add some antiflood code between
Code:
# Troll antiflood #
:
Code:
#############################################################################################################
# Troll v2.0 TCL by spithash@DALnet                                                                         #
#                                                                                                           #
# Gets troll quotes and makes people suffer!                                                                #
# Version 2.0 is way different since there's no database in the file. It fetches the quotes by a website.   #
# Also, you can ".chanset #channel +troll" to enable it.                                                    #
# I added this just in case you don't want your trolls to be available globally.                            #
#############################################################################################################
# Any official release of troll.tcl will be announced in http://forum.egghelp.org/viewtopic.php?t=17078     #
# Official troll.tcl updates will be in egghelp.org's TCL archive,                                          #
# Or here: http://bsdunix.info/spithash/troll/troll.tcl                                                     #
# (Keep it to "puthelp" cause I didn't add any flood protection yet,                                        #
# and it may cause your bot "Excess Flood" quit if it's in "putserv" or "putquick",                         #
# if someone floods the !troll trigger or if the troll quote is too long.)                                  #
#############################################################################################################
# Credits: special thanks to: username & speechles who helped me with this :)                               #
#############################################################################################################
setudef flag troll

# Troll antiflood #
set troll(delay) "15"
# Troll antiflood #

bind pub - !troll parce
proc parce {nick uhost hand chan text} {
    if {[channel get $chan troll]} {

# Troll antiflood #
        if {[info exists troll(lasttime,$chan)] && [expr $troll(lasttime,$chan) + $troll(delay)] > [clock seconds]} {
            putserv "NOTICE $nick :Next command only after [expr $troll(delay) - [expr [clock seconds] - $troll(lasttime,$chan)]] seconds. Yon can use 1 request in $cmd(delay) seconds."
            return 0
        }
# Troll antiflood #

::http::config -urlencoding utf-8 -useragent "Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.8.1) Gecko/2006101023 Firefox/2.0"
set url [::http::geturl "http://rolloffle.churchburning.org/troll_me.php" -timeout 15000]
set data [::http::data $url]
::http::cleanup $url
regsub -all -- {\n} $data "" data;
regexp -nocase -- {<p .*?>(.*?)</p>} $data -> info
regsub -all -- {(<strong[^>]*>)|(</strong>)} $info "\002" info;

# Troll antiflood #
    set troll(lasttime,$chan) [clock seconds]
# Troll antiflood #

while { $info != "" } {
    puthelp "PRIVMSG $chan :[string range $info 0 419]"
    set info [string range $info 420 end]
    }
 }
}
putlog "troll.tcl v2.0 by spithash@DALnet iz up and trollin'"
# EOF

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Thu Feb 02, 2012 3:19 pm    Post subject: Reply with quote

Code:
putserv "NOTICE $nick :Next command only after [expr $troll(delay) - [expr [clock seconds] - $troll(lasttime,$chan)]] seconds. Yon can use 1 request in $cmd(delay) seconds."

just a small typo in here.
Code:
$cmd(delay)

should off course be
Code:
$troll(delay)

_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
PrE
Voice


Joined: 14 Jan 2012
Posts: 10

PostPosted: Thu Feb 02, 2012 6:51 pm    Post subject: Reply with quote

Thanks for the help but it doesn't seem to work for some reason, doesn't send the user notice and the script continues to work with no delay between commands.
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Fri Feb 03, 2012 9:50 am    Post subject: Reply with quote

So lets wait untill spithash modify it properly.
Nobody can do it better then spithash.
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
spithash
Master


Joined: 12 Jul 2007
Posts: 248
Location: Libera

PostPosted: Thu Apr 12, 2012 2:06 pm    Post subject: Reply with quote

http://forum.egghelp.org/viewtopic.php?t=17078

Enjoy Smile
_________________
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
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