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.
Support & discussion of released scripts, and announcements of new releases.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jun 24, 2020 1:46 am
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.
illusionist
Voice
Posts: 25 Joined: Mon Mar 09, 2020 11:22 am
Post
by illusionist » Wed Jun 24, 2020 2:33 am
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 ...!!
illusionist
Voice
Posts: 25 Joined: Mon Mar 09, 2020 11:22 am
Post
by illusionist » Wed Jun 24, 2020 2:37 am
Caeser Sir Any Change in above mentioned code ??
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Jun 24, 2020 3:34 pm
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 }
}
}
illusionist
Voice
Posts: 25 Joined: Mon Mar 09, 2020 11:22 am
Post
by illusionist » Wed Jun 24, 2020 4:29 pm
i test this above script ... Bot did nothing... Just show the !reason msg is not on channel... No kick no error in partyline
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Jun 24, 2020 5:59 pm
that works in pm i tested it and it works flawlessly for the msg bot part
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Jun 24, 2020 6:23 pm
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.
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Thu Jun 25, 2020 9:04 am
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
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Thu Jun 25, 2020 2:41 pm
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.
illusionist
Voice
Posts: 25 Joined: Mon Mar 09, 2020 11:22 am
Post
by illusionist » Thu Jun 25, 2020 4:38 pm
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 ....
simo
Revered One
Posts: 1107 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Thu Jun 25, 2020 4:50 pm
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 }
}
}