This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Request Bot. Doesnt work correctly

Old posts that have not been replied to for several years.
Locked
s
stoo
Voice
Posts: 14
Joined: Fri Jan 30, 2004 1:10 pm

Request Bot. Doesnt work correctly

Post by stoo »

This script i am writing needs to join the channel specified with this

!request #chan

Then the bot join that channel, checks if that user who requested is an op, checks for Q or L in the channel and if there is over 40 users.

However, when the bot joins the channel it says there is no Q or L and there is only 1 user.

Code: Select all

bind pub o|o !request request:request

proc request:request {nick host handle chan text} {
global req_nick req_chan
set req_chan $text
set req_nick $nick
putquick "PRIVMSG #merc-finder :\002( #merc-finder )-(\002 Request service Inactive for 40 seconds while checking $req_chan \002)\002"

channel add $req_chan

bind join -|- "$req_chan $::botnick*" checks:checks
}

proc checks:checks {nick host handle chan} {
global req_nick req_chan
if {[isop $req_nick $req_chan]} { set isop 1 } { set isop 0 }


putquick "PRIVMSG $req_chan : Checking for \002Q\002 or \002L\002 bot..."

if {[onchan L $req_chan] || [onchan Q $req_chan]} {
set QLcheck 1
putquick "PRIVMSG $req_chan :\002Q or L\002 Found ! Requirement Met !"
} { set QLcheck 0
putquick "PRIVMSG $req_chan :No \002Q or L\002 Found ! Requirement \002NOT\002 Met !"
}

putquick "PRIVMSG $req_chan : Checking for\002 40 \002or More users ..."
set chan_amount [llength [chanlist $req_chan]]
if {$chan_amount >= 40} {
set chan_amount_check 1
putquick "PRIVMSG $req_chan :\002$chan_amount\002 users found ! Requirement Met !"
} {set chan_amount_check 0
putquick "PRIVMSG $req_chan :\002$chan_amount users found !\002 Requirement \002NOT\002 Met!"
}


set score [expr $isop+$chan_amount_check+$QLcheck]

if {[string match 3 $score]} { 
putquick "PRIVMSG $req_chan :#merc-finder Requiremnets met! Bringing in a relay."
channel remove $req_chan
putquick "PART $req_chan :\002( #merc-finder )-( \002Requirements met for $req_chan \002)\002!"
putquick "PRIVMSG #merc-finder.staff :!addrelay $req_chan"
} {
putquick "PRIVMSG $req_chan :#merc-finder Requiremnets NOT met!"
channel remove $req_chan
putquick "PART $req_chan : #merc-finder Requirements NOT met!"
putquick "PRIVMSG #merc-finder :Requirements not met for $req_chan"
}

}
i tested and made the bot join #magik^ and got this in my partyline aswell

Code: Select all

[mercfinder] [09:45] Tcl error [hnd:join]: illegal channel: #magik^
[09:45] -L (TheLBot@lightweight.quakenet.org)- [#MaGiK^]
 [09:45] Oops. Someone made me join #magik^... leaving...
Could anyone help me out here.

Much appriciated :)
Locked