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 

Need help on Arfer's why.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
DragonHeart
Voice


Joined: 11 May 2015
Posts: 8

PostPosted: Mon May 11, 2015 2:38 pm    Post subject: Need help on Arfer's why.tcl Reply with quote

This is the following code, which works perfectly fine. Just the problem is that I want to do this .chanset #channelname +cswhy

I dont want the bot to reply me on any and every channel. Please assist.

Code:
# why.tcl
# find out why users are op'd by chanserv services and onotice channel

set vWhyServ "chanserv@services.dal.net"
set vWhyTime 10

bind MODE - "% +o" pWhySend
bind NOTC - * pWhyReceive

proc pWhyCancel {} {
    global vWhyChan vWhyNick
    foreach item [utimers] {
        if {[string equal pWhyTimeout [lindex $item 1]]} {
            killutimer [lindex $item 2]
        }
    }
    if {[info exists vWhyNick]} {unset vWhyNick}
    if {[info exists vWhyChan]} {unset vWhyChan}
    return 0
}

proc pWhyReceive {nick uhost hand text dest} {
    global vWhyNick vWhyChan vWhyServ
    if {![regexp {^#} $dest]} {
        if {[string equal -nocase $nick [lindex [split $vWhyServ @] 0]]} {
            if {[info exists vWhyNick]} {
                set response [stripcodes bcruag $text]
                if {[string match -nocase *${vWhyNick}* [join [lrange [split $response] 0 2]]]} {
                    putserv "NOTICE @$vWhyChan :$response"
                    pWhyCancel
                }
            }
        }
    }
    return 0
}

proc pWhySend {nick uhost hand chan mode target} {
    global vWhyServ vWhyNick vWhyChan vWhyTime
    if {[string equal -nocase $nick [lindex [split $vWhyServ @] 0]]} {
        set vWhyNick $target
        set vWhyChan $chan
        putserv "PRIVMSG $vWhyServ :WHY $vWhyChan $vWhyNick"
        utimer $vWhyTime pWhyTimeout
    }
    return 0
}

proc pWhyTimeout {} {
    global vWhyNick vWhyChan
    putserv "PRIVMSG @$vWhyChan :a /WHY command for $vWhyNick timed out without response"
    pWhyCancel
    return 0
}

_________________
DragonHeart
#India on DALnet
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
Page 1 of 1

 
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