| View previous topic :: View next topic |
| Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Jun 24, 2020 1:46 am Post subject: |
|
|
| 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 |
|
 |
illusionist Voice
Joined: 09 Mar 2020 Posts: 25
|
Posted: Wed Jun 24, 2020 2:33 am Post subject: |
|
|
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 |
|
 |
illusionist Voice
Joined: 09 Mar 2020 Posts: 25
|
Posted: Wed Jun 24, 2020 2:37 am Post subject: |
|
|
| Caeser Sir Any Change in above mentioned code ?? |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Jun 24, 2020 3:34 pm Post subject: |
|
|
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 }
}
}
|
|
|
| Back to top |
|
 |
illusionist Voice
Joined: 09 Mar 2020 Posts: 25
|
Posted: Wed Jun 24, 2020 4:29 pm Post subject: |
|
|
| 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Jun 24, 2020 5:59 pm Post subject: |
|
|
| that works in pm i tested it and it works flawlessly for the msg bot part |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Jun 24, 2020 6:23 pm Post subject: |
|
|
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 }
}
} |
Last edited by simo on Thu Jun 25, 2020 2:43 pm; edited 1 time in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Jun 25, 2020 9:04 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Jun 25, 2020 2:41 pm Post subject: |
|
|
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 }
}
}
} |
Last edited by simo on Thu Jun 25, 2020 5:08 pm; edited 3 times in total |
|
| Back to top |
|
 |
illusionist Voice
Joined: 09 Mar 2020 Posts: 25
|
Posted: Thu Jun 25, 2020 4:38 pm Post subject: |
|
|
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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Jun 25, 2020 4:50 pm Post subject: |
|
|
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 }
}
}
|
|
|
| Back to top |
|
 |
|