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 Reason Problem (Bot Consider Reason as a Nick)

Help for those learning Tcl or writing their own scripts.
Post Reply
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Kick Reason Problem (Bot Consider Reason as a Nick)

Post by illusionist »

Code: Select all

set jaDu "!"
set jaDuSign "jaDuX"

		bind pub o|o ${jaDu}kick pub_kick
		bind msg o|o kick msg_kick
		bind pub o|o ${jaDu}k pub_kick
		bind msg o|o k msg_kick
#End
if {[info exist ban-time]} {
	# Checking whenever the "ban-time" variable is exist on your bot conf file. (Default)
	set gbantime ${ban-time}
} else {
	
	set gbantime 15
}
#Kick Process#
proc msg_kick {nick uhost hand rest} {
	global botnick jaDuSign
	if {![matchattr $hand p]} {putquick "NOTICE $nick :$jaDuSign You have +o privelage but you don't have +p, you need +p flag to set your password and authenticate before phrasing commands. Ask my owner/master to set that flag for you =)" ; return 0}
	set chan [lindex $rest 0] ; set knick [lrange $rest 1 end]
	if {$chan == "#" || $chan == ""} {putquick "NOTICE $nick :$jaDuSign Command: /msg $botnick kick <#channel> <nickname(s)> \[!reason\]" ; return 0}
	if {![string match "#*" $chan]} {set chan "#$chan"}
	if {$knick == ""} {putquick "NOTICE $nick :$jaDuSign Command: /msg $botnick kick $chan <nickname(s)> \[!reason\]" ; return 0}
	if {![validchan $chan]} {putquick "NOTICE $nick :$jaDuSign I am not on channel: $chan, check out my channel list." ; return 0}
	if {![botisop $chan]} {putquick "NOTICE $nick :$jaDuSign I appologize, but I am not an Operator on channel: $chan. Your command cannot be perform." ; return 0}
	set knicks "" ; set ownicks "" ; set nonenicks "" ; set reason ""
	foreach x $knick {
		if {(![onchansplit $x $chan]) && (![isbotnick $x])} {
			if {[string match "!*" $x]} { set cut [string range $rest [expr [string first ! $rest] +1] end] ; set reason "$cut $jaDuSign "} else {if {[matchattr [nick2hand $x $chan] m]} {append ownicks " $x"} else {if {![onchan $x $chan]} {append nonenicks " $x"} else {append knicks "$x,"}}}
		}
	}
	if {$nonenicks != ""} {putquick "NOTICE $nick :$jaDuSign $nonenicks is not on channel: $chan."}
	if {$ownicks != ""} {putquick "NOTICE $nick :$jaDuSign $ownicks are my \[Master(s)\], and will I will not Kick them from channel: $chan."}
	if {$knicks != ""} {
		if {$reason == ""} {set reason "You Are Not Welcome $jaDuSign"} ; putkick $chan $knicks $reason
		putcmdlog "$jaDuSign <<$nick>> !$hand! Kick: ${knicks} from channel: $chan. Reason: $reason."
	} ; return 0
}

proc pub_kick {nick uhost hand chan rest} {
	global jaDu botnick jaDuSign
	set chans "" ; set channel [lindex $rest 0]
	if {![string match "#*" $channel]} {set channel $chan ; append chans "$channel $rest "} else {append chans " $rest"}
	set knicks [lindex $chans 1]
	if {$knicks == ""} {putquick "NOTICE $nick :$jaDuSign Command: ${jaDu}kick $chan <nickname(s)> \[!reason\]" ; return 0}
	msg_kick $nick $uhost $hand $chans
}

############EnD KicK##############
I'm stiLL stuck in this Script ...
Default trigger for kick is ... !kick Nick !Reason
nd
!Kick Nick1 Nick2 Nick3 !Reason

I need help with this code. It works well with the default kick reason, but when given a reason, the word with ! sign is chosen as reason and rest words are considers as nick instead of picking the whole sentence as reason after ! sign.

Code: Select all

if {[string match "!*" $x]} { set cut [string range $rest [expr [string first ! $rest] +1] end] ; set reason "$cut $jaDuSign "} else {if {[matchattr [nick2hand $x $chan] m]} {append ownicks " $x"} else {if {![onchan $x $chan]} {append nonenicks " $x"} else {append knicks "$x,"}}}
problem is in these above lines
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Post by illusionist »

Test 1

Owner: !kick nick1 nick2 nick3 !Some Lengthy Reason Here

-eggdrop- (notice) Lengthy Reason Here is not on channel: #test

** Nick1 has been kicked by eggdrop (Some Lengthy Reason Here)
** Nick2 has been kicked by eggdrop (Some Lengthy Reason Here)
** Nick3 has been kicked by eggdrop (Some Lengthy Reason Here)

Test 2
With Placing ! Sign with some word of reason and some leave as it is without ! Sign


Owner: !kick nick1 nick2 nick3 !Some Lengthy !Reason Here

-eggdrop- (notice) Lengthy Here is not on channel: #test

** Nick1 has been kicked by eggdrop (Some !Reason)
** Nick2 has been kicked by eggdrop (Some !Reason)
** Nick3 has been kicked by eggdrop (Some !Reason)
Post Reply