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 

why tcl
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


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

PostPosted: Thu May 17, 2012 12:20 am    Post subject: Reply with quote

That's weird. The channel #chan is set correctly yet you don't see the op notice? Anyway, add:
Code:

if {![channel get $chan cswhy]} return
if {[lsearch $text "Identification"] == -1} return

before:
Code:

set csWhyList [channel get $chan csWhyList]

and remove the debug line and it should be working fine.
_________________
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
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Thu May 17, 2012 8:09 am    Post subject: Reply with quote

now I see the chanserv's reply on the telnet only.
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri May 18, 2012 4:20 am    Post subject: Reply with quote

The code in my previous comment makes it *ignore* any other notices if is not one regarding an issued WHY command, thus no more errors like that of a invalid channel.

To be honest I don't quite understand you. You said it's working, then it isn't and then you change your mind again. Decide already, is it working or not? I ran some tests and was working fine at me, yet at you it didn't. Don't know what exactly you've done there as it should work without any issues.

I'll get later on a bot on Dalnet servers and test this again, although the result shouldn't differ, meaning it's working as should.
_________________
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
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 19, 2012 4:34 am    Post subject: Reply with quote

I got the result only via telnet , not over ops notice.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Wed May 23, 2012 3:40 pm    Post subject: Reply with quote

caesar; any news?
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Thu May 24, 2012 12:35 am    Post subject: Reply with quote

Here's a new version:
Code:

namespace eval csWhy {
   setudef str csWhyList
   setudef flag cswhy

   bind mode * "% +o" [namespace current]::checkWhy
   bind notc * * [namespace current]::checkReply
   bind part * * [namespace current]::remove
   bind sign * * [namespace current]::remove
   bind nick * * [namespace current]::nick
   bind kick * * [namespace current]::kick
   bind join * * [namespace current]::botJoin

   # purge
   proc purge {chan user {newNick ""}} {
      set csWhyList [channel get $chan csWhyList]
      set pos [lsearch $csWhyList $user]
      if {$pos != -1} {
         if {![llength $newNick]} {
            set csWhyList [lreplace $csWhyList $pos $pos]
         } else {
            set csWhyList [lreplace $csWhyList $pos $pos $newNick]
         }
         channel set $chan csWhyList $csWhyList
      }
      return $pos
   }
   
   # cleanup
   proc cleanup {chan user} {
      if {[isbotnick $user]} {
         channel set $chan csWhyList {}
      } else {
         purge $chan $user
      }
   }
   
   # join
   proc botJoin {nick uhost hand chan} {
      if {[isbotnick $nick]} {
         channel set $chan csWhyList {}
      }
    }
   
   # kick
   proc kick {nick uhost handle chan vict reason} {
      if {![channel get $chan cswhy]} return
      if {![wasop $chan $nick]} return
      cleanup $chan $nick
   }

   # part & sign
   proc remove {nick uhost handle chan {text ""}} {
      if {![channel get $chan cswhy]} return
      cleanup $chan $nick
   }

   # nick
   proc nick {nick uhost handle chan newNick} {
      if {[isbotnick $nick] || ![channel get $chan cswhy]} return
      if {![isop $chan $nick]} return
      puthelp "ChanServ WHY $chan $newNick"
      purge $chan $nick $newNick
   }
   
   # 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]
      if {[lsearch $text "Identification"] == -1} return
      set chan [string trim [lindex $text 5] {.}]
      if {![channel get $chan cswhy]} return
      set user [lindex $text 0]
      if {[purge $chan $user] != -1} {
         puthelp "NOTICE @$chan :$text"
      }
   }
}

putlog "cswhy.tcl loaded.."

I joined Dalnet in order to check this out but needed AOP on a channel to issue the WHy command so I had to fake a few things in order to test this out, and from my results it's working fine.
Quote:

* bot sets mode: +o caesar
<@bot> ChanServ WHY #chan caesar
-bot:@#chan- @ caesar has FOUNDER access to #chan. Reason: Identification to services with the channel password. Channel Frozen: NO

* caesar is now known as user
<@bot> ChanServ WHY #chan user

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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