Code: Select all
<Tosser> !request #chanserv
* aP|Request has joined #chanserv
* aP|Request has left #chanserv
<aP|Request> [19:11] joined #chanserv but didn't want to!
<Tosser> !bots
<aP|Request> [19:13] Tcl error [::request::bots]: missing "
<aP|Request> [19:13] Tcl error [::request::bots]: missing "
<Tosser> !rules
-aP|Request- Only 1 bot allowed per channel
<aP|Request> [19:14] Tcl error [::request::rules]: can't read "request::service": no such variable
<aP|Request> [19:14] Tcl error [::request::rules]: can't read "request::service": no such variable
Code: Select all
namespace eval request {
# copyright info, dont change these variables, or make your own request script
variable author "Tosser"
variable version "1.0.0.0"
# what trigger would you like, for example !request
variable trigger "!request"
# this is where you set the requirements
# do you need a network/channel service, for example the Q/L bot on quakenet [1=yes/0=no]
variable service "1"
# how many users are needed
variable needed "30"
# set here the flags the bot needs on Q/L if variable service is set to 1
variable flags "ao"
### please note, this script does not include a clonescan !!
# set here your home channel, please note this will be the only channel people can request from
variable homechan "#antipjen"
##### DONT NOT TOUCH THIS VARIABLE !!
variable busy "0"
# the binds, there is no need to change these binds
# public (channel) binds
bind pub -|- "$trigger" [namespace current]::request
bind pub -|- "!bots" [namespace current]::bots
bind pub -|- "!rules" [namespace current]::rules
# The bot managment bind, allows you the user to message the bot to add/remove/list requestable bots
bind msg -|- "request" [namespace current]::management
}
setudef flag request
proc request::bots {nickname hostname handle channel arg} {
set requestable {}
foreach user [userlist] {
if {[matchattr $user b] && [matchattr $user R]} {
lappend requestable [hand2nick $user]
}
}
putserv "NOTICE $nickname :Here is a list of my requestable bots:"
putserv "NOTICE $nickname :[join $requestable ", "]""
}
proc request::rules {nickname hostname handle channel arg} {
putserv "NOTICE $nickname :Only 1 bot allowed per channel"
putserv "NOTICE $nickname :The bot must have +$request::flags on Q/L"
putserv "NOTICE $nickname :The bot must have op on the channel at all times"
putserv "NOTICE $nickname :You are not allowed to deop/ban/kick the bot at any time for any reason"
putserv "NOTICE $nickname :If you dont agree to these rules, then dont not request a bot"
putserv "NOTICE $nickname :If any of these rules are broken, for any reason, then your channel will be shitlisted"
putserv "NOTICE $nickname :Please note, an admin can remove/shitlist your channel at any time for any reason without any notice"
}
proc request::request {nickname hostname handle channel text} {
if {![channel get $request::homechan request]} {
putserv "NOTICE $nickname :Sorry, but request is currenty offline"
} elseif {![string match -nocase $request::homechan $channel]} {
putserv "NOTICE $nickname :Error: you can only request a bot from my homechannel, which is $request::homechan"
} elseif {![string match -nocase "*users.quakenet.org" $hostname]} {
putserv "NOTICE $nickname :Sorry, but you need to be authed with Q and have mode +x set before you can request a bot"
} elseif {$request::busy == "1"} {
putserv "NOTICE $nickname :Sorry, but another request is taking place, please wait a few seconds"
} else {
set thechan [lindex [split $text] 0]
if {$thechan == ""} {
putserv "NOTICE $nickname :Please enter a channel name using !request #channel"
return 0
}
if {[string index $thechan 0] != "#"} {
putserv "NOTICE $nickname :Please enter a channel name starting with '#' using !request #channel"
return 0
}
set request::busy "1"
request::check $nickname $hostname $thechan
}
}
proc request::check {nickname hostname thechan} {
if {$request::busy} {
if {![validchan $thechan]} {
channel add $thechan
foreach user [userlist bR] {
if {[onchan [hand2nick $user] $thechan]} {
putserv "NOTICE $nickname :Request failed: Bot $user in already on $thechan"
putlog "Request failed: Channel: $thechan By: $nickname \($hostname\) Reason: $user was on $thechan"
channel remove $thechan
set request::busy "0"
save
return 0
}
}
if {![onchan $nickname $thechan]} {
putserv "NOTICE $nickname :Request failed: You are not on $thechan"
putlog "Request failed: Channel: $thechan By: $nickname \($hostname\) Reason: not on $thechan"
channel remove $thechan
set request::busy "0"
save
return 0
}
if {![isop $nickname $thechan]} {
putserv "NOTICE $nickname :Request failed: You are not opped on $thechan"
putlog "Request failed: Channel: $thechan By: $nickname \($hostname\) Reason: not opped on $thechan"
channel remove $thechan
set request::busy "0"
save
return 0
}
if {![onchan L $thechan] && ![onchan Q $thechan]} {
putserv "NOTICE $nickname :Request failed: No Q/L found on $thechan"
putlog "Request failed: Channel: $thechan By: $nickname \($hostname\) Reason: No Q/L found on $thechan"
channel remove $thechan
set request::busy "0"
save
return 0
}
if {[llength [chanlist $thechan]] < $request::needed} {
putserv "NOTICE $nickname :Request failed: There is not enough users on $thechan"
putlog "Request failed: Channel: $thechan By: $nickname \($hostname\) Reason: less than $request::needed users"
channel remove $thechan
set request::busy "0"
save
return 0
}
if {[llength [bots]] >= 1} {
set bot [lindex [bots] [rand [llength [bots]]]]
putbot $bot "addchan $thechan $nickname $hostname"
putserv "NOTICE $nickname :Request accepted: bot [hand2nick $bot] should join $thechan soon, if [hand2nick $bot] does not join, please report this to an admin in $request::homechan"
}
}
}
}
putlog "Request.tcl v$request::version by $request::author loaded !!"
Thanks in advance
Chris