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

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 13, 2012 2:12 pm Post subject: |
|
|
Err.. try this:
| Code: |
namespace eval csWhy {
setudef str csWhyList
setudef flag cswhy
bind mode * "% +o" [namespace current]::checkWhy
bind notc * * [namespace current]::checkReply
# someone got OP'ed on the channel
proc checkWhy {nick uhost hand chan mode target} {
if {[isbotnick $target]} return
if {![channel get $chan cswhy]} return
set csWhyList [channel get $chan csWhyList]
lappend csWhyList $target
channel set $chan csWhyList $csWhyList
puthelp "ChanServ WHY $chan $target"
}
# reply of WHY command from ChanServ
proc checkReply {nick uhost hand text {dest ""}} {
if {[string equal -length 1 # $dest]} return
if {$nick neq "ChanServ"} return
set text [split $text]
set user [lindex $text 0]
set chan [string trim [lindex $text 5] {.}]
set csWhyList [channel get $chan csWhyList]
if {![string equal $nick "ChanServ"]} return
set pos [lsearch $csWhyList $user]
set csWhyList [lreplace $csWhyList $pos $pos]
channel set $chan csWhyList $csWhyList
puthelp "NOTICE @$chan :$text"
}
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sun May 13, 2012 2:30 pm Post subject: |
|
|
[20:29:38] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ...
[20:29:38] -ChanServ (service@dal.net)- nick has SOP access to #chan. Reason: Identification to the nickname nick. Channel Frozen: NO
[20:29:38] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ... |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 13, 2012 3:10 pm Post subject: |
|
|
There's no "neq" in the last piece of code I've posted above. Make sure you copy/paste it right and load that file on the bot then rehash it. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun May 13, 2012 4:25 pm Post subject: |
|
|
Actually, there is:
| Code: | | if {$nick neq "ChanServ"} return |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sun May 13, 2012 9:40 pm Post subject: |
|
|
| Yes , like nml said (line 20) |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 14, 2012 12:17 am Post subject: |
|
|
| Code: |
namespace eval csWhy {
setudef str csWhyList
setudef flag cswhy
bind mode * "% +o" [namespace current]::checkWhy
bind notc * * [namespace current]::checkReply
# someone got OP'ed on the channel
proc checkWhy {nick uhost hand chan mode target} {
if {[isbotnick $target]} return
if {![channel get $chan cswhy]} return
set csWhyList [channel get $chan csWhyList]
lappend csWhyList $target
channel set $chan csWhyList $csWhyList
puthelp "ChanServ WHY $chan $target"
}
# reply of WHY command from ChanServ
proc checkReply {nick uhost hand text {dest ""}} {
if {[string equal -length 1 # $dest]} return
if {![string equal $nick "ChanServ"]} return
set text [split $text]
set user [lindex $text 0]
set chan [string trim [lindex $text 5] {.}]
set csWhyList [channel get $chan csWhyList]
set pos [lsearch $csWhyList $user]
if {$pos == -1} return
set csWhyList [lreplace $csWhyList $pos $pos]
channel set $chan csWhyList $csWhyList
puthelp "NOTICE @$chan :$text"
}
}
|
There. Was tiered so mixed a few lines and forgot a few things. It should work now. Hopefully.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Mon May 14, 2012 5:17 am Post subject: |
|
|
[11:16:38] Tcl error [::csWhy::checkReply]: no such channel record
[11:16:38] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue May 15, 2012 1:13 am Post subject: |
|
|
That's weird. I just tested this and works as should.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Tue May 15, 2012 9:21 am Post subject: |
|
|
I tried it again but it gives the same error.
[11:16:38] Tcl error [::csWhy::checkReply]: no such channel record
[11:16:38] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 16, 2012 12:18 am Post subject: |
|
|
Is #chan a valid channel? Add the following
| Code: |
if {![validchan $chan]} return
|
before:
| Code: |
set csWhyList [channel get $chan csWhyList]
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Wed May 16, 2012 5:38 am Post subject: |
|
|
| I got no errors now , but it replies the result to the telnet not to the @#chan O.o |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 16, 2012 9:44 am Post subject: |
|
|
Wait, what?!
So, you see the reply (notice) from ChanServ and the bot itself repeats the same line in the telnet, or you see only ChanServ's reply? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Wed May 16, 2012 10:48 am Post subject: |
|
|
| exactly , I see the chanserv's reply on the telnet only. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 16, 2012 1:32 pm Post subject: |
|
|
Since the channel variable is set correctly:
| tclsh wrote: |
% set text "nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO"
nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO
% string trim [lindex [split $text] 5] {.}
#chan
|
I don't get it why it says #chan is not valid.
Let's do a little debug of the chan variable by adding:
| Code: |
putlog "cswhy.tcl debug - chan is: $chan"
|
after:
| Code: |
set chan [string trim [lindex $text 5] {.}]
|
and report back what you get in telnet. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Wed May 16, 2012 1:59 pm Post subject: |
|
|
here we go
[19:55:49] cswhy.tcl debug - chan is: #chan
[19:55:49] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO
And I got this on telnet on channel which the script is disabled in.
[19:56:18] cswhy.tcl debug - chan is: xeo |
|
| Back to top |
|
 |
|