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 & Kick Counter HeLp for Kick Via PVT Msg
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3645
Location: Mint Factory

PostPosted: Wed Jun 24, 2020 1:46 am    Post subject: Reply with quote

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:

% 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.
Back to top
View user's profile Send private message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 15

PostPosted: Wed Jun 24, 2020 2:33 am    Post subject: Reply with quote

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

Quote:
(@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 ...!!
Back to top
View user's profile Send private message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 15

PostPosted: Wed Jun 24, 2020 2:37 am    Post subject: Reply with quote

Caeser Sir Any Change in above mentioned code ??
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Wed Jun 24, 2020 3:34 pm    Post subject: Reply with quote

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

Code:

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

_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 15

PostPosted: Wed Jun 24, 2020 4:29 pm    Post subject: Reply with quote

i test this above script ... Bot did nothing... Just show the !reason msg is not on channel... No kick no error in partyline
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Wed Jun 24, 2020 5:59 pm    Post subject: Reply with quote

that works in pm i tested it and it works flawlessly for the msg bot part
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Wed Jun 24, 2020 6:23 pm    Post subject: Reply with quote

i forgot u use !reason i usually use .reason


Code:


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

_________________
Coming together is a beginning, staying together is progress, working together is succes.


Last edited by simo on Thu Jun 25, 2020 2:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Thu Jun 25, 2020 9:04 am    Post subject: Reply with quote

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
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Thu Jun 25, 2020 2:41 pm    Post subject: Reply with quote

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:

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

_________________
Coming together is a beginning, staying together is progress, working together is succes.


Last edited by simo on Thu Jun 25, 2020 5:08 pm; edited 3 times in total
Back to top
View user's profile Send private message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 15

PostPosted: Thu Jun 25, 2020 4:38 pm    Post subject: Reply with quote

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 ....
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 444

PostPosted: Thu Jun 25, 2020 4:50 pm    Post subject: Reply with quote

your welcome and for pub command i would use :

Code:

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

_________________
Coming together is a beginning, staying together is progress, working together is succes.
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
Goto page Previous  1, 2
Page 2 of 2

 
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