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 

Kick remove

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sun Aug 05, 2012 11:20 am    Post subject: Kick remove Reply with quote

Hello ,

While using the script below;
1. The bot kicks anyone who join and got Chanserv access on the channel with the "set kr_remove(reason)" + deleting him/her.
2. It's enabling the script in all channels which the bot is in.

Code:
##########################################################
# Kick Remove Script                                     #
# Version 1.0                                            #
# Pahlwaan <Gondals@Msn.com>                             #
##########################################################

# This script will deop and remove ChanServ access from a user if they kick the bot.
# The bot must have SOp access for this script to work.
# Channel Founders and SOp's are ignored, only AOp's are affected.
# DALnet only script.
# For use in Eggdrop 1.6.17 and upwards *only*.

##
# Commands
##
#
# chanset <#channel> <+/->kr.remove
#   This enables (+) or disables (-) the script for the particular channel.
#     Command console:  Dcc
##

#########################################################################
# Settings - alter this section of the script                           #
#########################################################################

# Message to send via notice to offender.
# Alter text to suite.
set kr_remove(notice) "You tit head, you just lost access!"

# Reason given when offender is kicked from the channel.
# Alter text to suite. Setting kr_remove(reason) to "" disables.
set kr_remove(reason) "Kicking Me Won't Get You Anywhere."

#########################################################################
##################### DO NOT EDIT BELOW THIS LINE!! #####################
#########################################################################

# Full name of channel services
set chanserv "chanserv@Services.dal.net"

setudef flag kr.remove

bind kick - * kick:remove

bind notc - "*Identification to the nickname *" check:verify

proc kick:remove {nick uhost hand chan targ rsn} {
  if {$targ == $::botnick} {
   if {[channel get $chan kr.remove]} {
     putserv "PRIVMSG $::chanserv :why $chan $nick" -next
    }
  }
}

proc check:verify {nick host hand arg {dest ""}} {
  set msg [stripcodes b $arg]
  if {[string equal $dest $::botnick]} {
#   Parse ChanServ's message.
    set offender [lindex [split $msg] 0]
    set aop [string tolower [lindex [split $msg] 2]]
    set chan [string trim [lindex [split $msg] 5] .]
    set opnick [string trim [lindex [split $msg] end] .]
#   Only an AOp can be punished.
    if {![string match $aop "aop"]} {return}
#   Delete access, remove op & kick with appropriate message.
    putquick "PRIVMSG $::chanserv :aop $chan del $opnick" -next
    putquick "MODE $chan -o $offender" -next
    if {$::kr_remove(reason) == ""} {set $::kr_remove(reason) $::botnick}
    putquick "KICK $chan $offender :$::kr_remove(reason)" -next
    putquick "notice $offender :$::kr_remove(notice)"

#   Check and see if the offender is in the bots' user list
#   If so, delete them!
    set thehand [findhand $offender [getchanhost $offender]]

    if {$offender != "" && $thehand != "*"} {
        deluser $thehand
   putcmdlog "Deleted !$offender! from the user database."
   save
    }
  }
}

# findhand - tries to find a handle

proc findhand {nick host} {
   if {[validuser $nick]} {
      return $nick
   } else {
      set thehand [nick2hand $nick]
      if {[validuser $thehand]} {
         return $thehand
      }

      set thehand [finduser $host]
      return $thehand
   }
}

### End ###

set kr(version) " 1.0"
set kr(script_name) "Kick Remove"

putlog "TCL \002loaded\002: $kr(script_name)$kr(version) by Pahlwaan."

##
# History
##
# v1.2 (24.08.04)
# Replaced "ctrl:filter" proc with new
# internal command: stripcodes <strip-flags> <string>
# v1.1 (12.05.04)
# Added <+/->kr.remove DCC command.
# Added kick.
# Added configurable message/notice text.
##


Any fix please ?
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Mon Aug 06, 2012 4:04 pm    Post subject: Reply with quote

it can't be fixed ?
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat Aug 11, 2012 9:27 am    Post subject: Reply with quote

no one can help ?!
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Sat Aug 11, 2012 9:51 am    Post subject: Reply with quote

to stop it working in all channels change change this

Code:
proc kick:remove {nick uhost hand chan targ rsn} {
  if {$targ == $::botnick} {
   if {[channel get $chan kr.remove]} {
     putserv "PRIVMSG $::chanserv :why $chan $nick" -next
    }
  }
}


to this

Code:
proc kick:remove {nick uhost hand chan targ rsn} {
  if {$targ == $::botnick} {
   if {[channel get $chan kr.remove] == 1} {
     putserv "PRIVMSG $::chanserv :why $chan $nick" -next
    }
  }
}


the line if {[channel get $chan kr.remove]} {
will return 1 for enabled and 0 if its not, how it was there was no check so it worked in all the chans the bot is on.. i dunno about the chanserv problem your having maybe someone else will Wink
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Aug 11, 2012 10:50 am    Post subject: Reply with quote

Sorry to disappoint you, but that modification will not change anything...
Tcl considers anything but zero to be true, and if you were to expand the test using expr, the result would also be 1.

The problem to me, rather seems to be that the delete/kick is triggered solely upon receiving a notice from chanserv containing "Identification to the nickname". If there's any other scripts loaded that also issues the "why" command to chanserv, that would trigger this script to kick/delete that user as well...
At a minimum, this script would have to be extended with a list of pending punishments in order to be reliable.
Also, there is no validation of the source of the notice, meaning anyone could fake a notice to your bot, even bypassing the "only AOP"-check. Potentially, someone could lock you out from your bot by deleting your handle/account...
_________________
NML_375, idling at #eggdrop@IrcNET
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 Support & Releases 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