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.

[SOLVED] Kick Counter HeLp for Kick Via PVT Msg

Support & discussion of released scripts, and announcements of new releases.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

SpiKe^^ wrote:Don't use append (a+)
Use w or w+
I guess you missed the "truncate it if it exists" part.

Anyway, did some testing and looks like with "r+" works as expected.

Code: Select all

% proc count:kicks args {
	set fh [open "~/test.txt" "r+"]
	set count [expr [read -nonewline $fh] + 1]
	seek $fh 0
	puts $fh $count
	close $fh
	return $count
}
% count:kicks
11
% count:kicks
12
% count:kicks
13
% count:kicks
14
Once the game is over, the king and the pawn go back in the same box.
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Post by illusionist »

i test this code ... It works but if type !kick somenick and the unfortunately somenick is not on #channel ... Code CounT it as a kick.. and increase the counter ... And in next kick it jumps like
(@eggdrop) ~kick somenick !this is counter test No 1
** Somenick has been kicked by eggdrop (Reason: this is counter test No 1 Requested by: eggdrop -631-)
(@eggdrop) ~kick SomeNick2 !This is test counter test No2 with no nick
-eggdrop- SomeNick2 is not on channel: #test.
(@eggdrop) ~kick somenick !this is counter test No 3
** Somenick has been kicked by eggdrop (Reason: this is counter test No 3 Requested by: eggdrop -633-)
Thanks ...!!
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Post by illusionist »

Caeser Sir Any Change in above mentioned code ??
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this seems to work for me you can add in the kick counter and such

Code: Select all

bind msg o !kick msg_kick
 

proc  msg_kick {nick uhost hand rest} {
   global botnick
   set chan [lindex $rest 0]  
   if {$chan == "#" || $chan == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
   if {[lrange $rest 1 end] == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
        set rest [lrange $rest 1 end]
         set reason [join [lrange [split $rest "."] 1 end] "."]
	set rest  [lindex [split $rest "."] 0]
	if {$reason eq ""} { set reason Requested }

		foreach user $rest {

			if {![onchan $user $chan]} {
				putserv "NOTICE $nick $user is not on channel $chan"
			} elseif {![isvoice $user $chan] && ![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan]} {  putkick $chan  $user $reason }
		}
}
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Post by illusionist »

i test this above script ... Bot did nothing... Just show the !reason msg is not on channel... No kick no error in partyline
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

that works in pm i tested it and it works flawlessly for the msg bot part
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i forgot u use !reason i usually use .reason

Code: Select all


bind msg o !kick msg_kick
 

proc  msg_kick {nick uhost hand rest} {
   global botnick
   set chan [lindex $rest 0] 
   if {$chan == "#" || $chan == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
   if {[lrange $rest 1 end] == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
        set rest [lrange $rest 1 end]
         set reason [join [lrange [split $rest "!"] 1 end] "!"]
   set rest  [lindex [split $rest "!"] 0]
   if {$reason eq ""} { set reason Requested }

      foreach user $rest {

         if {![onchan $user $chan]} {
            putserv "NOTICE $nick $user is not on channel $chan"
         } elseif {![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan]} {  putkick $chan  $user $reason }
      }
}
Last edited by simo on Thu Jun 25, 2020 2:43 pm, edited 1 time in total.
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

what i failed to understand is since u asked for kick via private message to bot why u use pub wich is used on channel the code i previously posted uses just that private message as u requested

few examples in pm of ur eggbot:

!kick #somechannel nick1 nick2 nick3 nick4 nick35 nick6 !custom reason here

!kick #somechannel nick1 nick2 nick3 nick4 nick35 nick6

!kick #somechannel nick !custom reason here

!kick #somechannel nick
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this lets chanops chanhalfops and those with access to bot set the command as well if for some reason thats the next thing u seek it to do

Code: Select all

bind msg - !kick msg_kick
 

proc  msg_kick {nick uhost hand rest} {
   global botnick
   set chan [lindex $rest 0]
 if {![botisop $chan]} { puthelp "NOTICE $nick :I'm not oped on $chan." ; return 0 }
 if {![isop $nick $chan] && ![ishalfop $nick $chan] && ![matchattr [nick2hand $nick] o|o $chan]} {  
   if {$chan == "#" || $chan == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
   if {[lrange $rest 1 end] == ""} {putquick "NOTICE $nick :Command: /msg $botnick !kick \[channel\] \[nick(s)\] \[!reason\]" ; return 0}
     set rest [lrange $rest 1 end]
     set reason [join [lrange [split $rest "!"] 1 end] "!"]
     set rest  [lindex [split $rest "!"] 0]
   if {$reason eq ""} { "Reason: You Are Not welcome. Requested by: $nick -[count:kicks]-" }

      foreach user $rest {

         if {![onchan $user $chan]} {
            putserv "NOTICE $nick $user is not on channel $chan"
         } elseif {![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan]} {  putkick $chan  $user $reason }
      }
}
}
Last edited by simo on Thu Jun 25, 2020 5:08 pm, edited 3 times in total.
i
illusionist
Voice
Posts: 25
Joined: Mon Mar 09, 2020 11:22 am

Post by illusionist »

Thanks Simo that was a complete script including pub nd msg commands...

Thats wahy i posted Both... You Change Lots Of things in It but It works Now Thanks ....
s
simo
Revered One
Posts: 1069
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

your welcome and for pub command i would use :

Code: Select all

bind pub -|- !kick pub:kick
proc pub:kick {nick host hand chan text} {
  global botnick
     if {![isop $nick $chan] && ![ishalfop $nick $chan] && ![matchattr [nick2hand $nick] o|o $chan]} { return 0 }
	if {![botisop $chan]} { puthelp "NOTICE $nick :I'm not oped on $chan." ; return 0 }
   set reason [join [lrange [split $text "!"] 1 end] "!"]
	set text  [lindex [split $text "!"] 0]
	if {$reason eq ""} { set reason "Reason: You Are Not welcome. Requested by: $nick -[count:kicks]-"  }
	foreach user $text {

		if {![onchan $user $chan]} {
			putserv "NOTICE $nick $user is not on channel $chan"
		} elseif {![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan]} {  putkick $chan  $user $reason }
	}
}
Post Reply