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.

Kick remove

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Kick remove

Post by Amr »

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: Select all

##########################################################
# 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 ?
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

it can't be fixed ?
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

no one can help ?!
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

to stop it working in all channels change change this

Code: Select all

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: Select all

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:
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
Post Reply