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

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


Joined: 09 Mar 2020
Posts: 25

PostPosted: Wed Sep 01, 2021 11:28 pm    Post subject: Kick Reason Problem (Bot Consider Reason as a Nick) Reply with quote

Code:
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##############


Quote:
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:
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,"}}}


Quote:
problem is in these above lines
Back to top
View user's profile Send private message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 25

PostPosted: Wed Sep 01, 2021 11:50 pm    Post subject: Reply with quote

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)
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