| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 27, 2020 4:59 pm Post subject: wont kick nicks with chars like {} |
|
|
i wonder why this wont kick nicks with chars like {} in it
like: {[nick]} [nick]
using this atm:
| Code: |
bind pub n .k pub:kicker
proc pub:kicker {nick host hand chan text} {
global botnick
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm not oped on $chan."
return
}
set users [list]
set reason [join [lrange [split $text "."] 1 end] "."]
set text [lindex [split $text "."] 0]
if {$reason eq ""} { set reason Requested }
foreach user $text {
if {![onchan $user $chan]} {
putserv "NOTICE $nick $user is not on channel $chan"
} else {
lappend users $user
}
}
stackKicks $chan [join $users] $reason 4
}
proc stackKicks {chan kicklist reason {max 4}} {
set count [llength $kicklist]
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $kicklist 0 [expr {$max - 1}]] ","]
set kicklist [lrange $kicklist $max end]
incr count -$max
} else {
set users [join $kicklist ","]
set count 0
}
putnow "KICK $chan $users $reason"
}
}
|
it keeps returning nick isnt on channel while he is
Last edited by simo on Wed Jul 29, 2020 11:16 am; edited 2 times in total |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Jul 27, 2020 6:39 pm Post subject: |
|
|
Ok, so your script is to answer to ".k aaa bbb ccc.reason of kick" ? (with "aaa", "bbb" and "ccc" as nicks of victims)
Quite strange as syntax, but nevermind...
You do: set text [lindex [split $text "."] 0] and after: foreach user $text {... $text is not a list but an element of list, so it can rarely match an user.
foreach user [split [join $text] " "] might be better imho. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 27, 2020 8:32 pm Post subject: |
|
|
thank your for the reply crazycat and yes i use this to have the option of multiple nicks in a kick command and a custom kick reason so to determine the diffence between a nick and the custom kick reason the . comes in place or that was the idea at least
like: | Quote: | | .k nick nick nick nick .some custom reason here |
it worked fine untill i was trying to kick nicks with weird chars in them |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 27, 2020 8:39 pm Post subject: |
|
|
i tried using your suggestion using the foreach user [split [join $text] " "]
but the result is the same it doesnt kick nicks with weird chars in them
| Code: |
bind pub n .k pub:kicker
proc pub:kicker {nick host hand chan text} {
global botnick
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm not oped on $chan."
return
}
set users [list]
set reason [join [lrange [split $text "."] 1 end] "."]
set text [lindex [split $text "."] 0]
if {$reason eq ""} { set reason Requested }
foreach user [split [join $text] " "] {
if {![onchan $user $chan]} {
putserv "NOTICE $nick $user is not on channel $chan"
} else {
lappend users $user
}
}
stackKicks $chan [join $users] $reason 4
}
|
with chars like {}[] in nick it returned with : {{Tessie}} is not on channel #test
Last edited by simo on Tue Jul 28, 2020 7:48 am; edited 1 time in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Jul 27, 2020 9:35 pm Post subject: |
|
|
simo:
Your code is a bit ugly, but try this instead... | Code: | | foreach user [split $text] { |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 27, 2020 10:43 pm Post subject: |
|
|
| Thanks for the reply Spike^^ i would like to see the more proper way of writing this as this is what i have been using so far if this is not proper please show me how its done so i can use that as reference for others i use tnx spike^^ |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 7:47 am Post subject: |
|
|
i tried adding in the foreach u posted Spike^^
| Code: |
bind pub n .k pub:kicker
proc pub:kicker {nick host hand chan text} {
global botnick
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm not oped on $chan."
return
}
set users [list]
set reason [join [lrange [split $text "."] 1 end] "."]
set text [lindex [split $text "."] 0]
if {$reason eq ""} { set reason Requested }
foreach user [split $text] {
if {![onchan $user $chan]} {
putserv "NOTICE $nick $user is not on channel $chan"
} else {
lappend users $user
}
}
stackKicks $chan [join $users] $reason 4
}
|
it keeps returning this without showing the nick : is not on channel #test |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Jul 28, 2020 9:50 am Post subject: |
|
|
| Quote: |
it keeps returning this without showing the nick : is not on channel #test |
Find out exactly what is in $text.
Immediately before this line:
| Code: |
foreach user [split $text] {
|
try something like this:
| Code: |
putserv "privmsg $chan :text is: $text "
|
and then
| Code: |
putserv "privmsg $chan :split text is: [split $text] "
|
Now you're going to see exactly what that foreach command is about to operate on. Perhaps that will hold a clue. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 10:25 am Post subject: |
|
|
thanx willyw i tried that and output is :
the nick is: {[test]}
using .k {[test]}
the putserv "privmsg $chan :text is: $text "
returns : text is: {[test]}
and the putserv "privmsg $chan :split text is: [split $text] "
returns: split text is: {{[test]}} |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 11:33 am Post subject: |
|
|
| still cant get the nicks with {} in them not sure why it stores them stripped from the {} so when it tries to kick it obviously says not on channel so it must be the storing part that goes wrong im not sure how to store nicks proper with all their chars intact so it can proceed to kick |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Jul 28, 2020 12:53 pm Post subject: |
|
|
Something's not right.
Earlier, you'd said:
| Quote: |
it keeps returning this without showing the nick : is not on channel #test
|
I saw that nothing was there, for the value in $user , and posted. The idea was to find out what was in $text, exactly - and hopefully be able to figure out why $user was empty.
That's not happening now. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 1:32 pm Post subject: |
|
|
| yes the last code i posted doesnt show the actuall nick in the notice of nick not online |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 3:51 pm Post subject: |
|
|
im stuck cant figure a way to fix this issue i saw im not the first with this issue i saw this old post : http://forum.egghelp.org/viewtopic.php?t=11001
altho this doesnt stack nicks wich is what i was looking for |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 28, 2020 6:30 pm Post subject: |
|
|
| Thanx crazycat except the thing is i already used split in the set im not sure its a good idea to have duplicate split text |
|
| Back to top |
|
 |
|