Code: Select all
#######################
## auto-invite.tcl ##
## v1.0 01/18/2006 ##
## Coded by iNFERiON ##
#######################
# DESCRIPTION #
#######################
# This script will monitor a channel for joining people
# and see if their hostname is in the by you specified file.
# If it is, it will auto-invite that person to a +i channel of your choice.
# This is easy if you have a public and a private channel like #mychan and #mychan.crew
# A bot master (+m) can add hosts to the invitehosts.txt file by using !addinvite <hostmask>,
# e.g. !addinvite ~me@my.ISP.here.net
# For extra security, this command only works in the +i chan.
#
# Enjoy :)
######################
### Config ###
# Hostlist file?
set hostlist_file "invitehosts.txt"
# Listen channel?
set listen_chan "#changeme"
# Invite channel?
set invite_chan "#invitemehere"
# Nick to notify about sent invites?
set notify_nick "BotOwner"
# Notice to send before invite?
set invite_note "You are recognized as crew member, inviting you to the crew channel."
### End of config ###
### Do NOT edit below ###
bind pub m !addinvite ai_add
bind join - * ai_join
proc ai_join { nick host handle chan } {
global hostlist_file listen_chan invite_chan notify_nick invite_note
if {$chan == $listen_chan} {
set fname $hostlist_file
set fp [open $fname "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
foreach line $lines {
if {[string match -nocase "$host" $line]} {
puthelp "NOTICE $notify_nick :Inviting $nick to $invite_chan"
puthelp "NOTICE $nick :$invite_note"
putserv "INVITE $nick :$invite_chan"
}
}
}
}
proc ai_add { nick host handle chan text } {
global hostlist_file invite_chan
if {$chan == $invite_chan} {
set newhost "$text"
set fname $hostlist_file
set fp [open $fname "a"]
puts $fp $newhost
close $fp
puthelp "NOTICE $nick :Done."
}
}
putlog "Auto-invite v1.0 by iNFERiON loaded"